xref: /csrg-svn/usr.bin/f77/libU77/gerror_.c (revision 47944)
1*47944Sbostic /*-
2*47944Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47944Sbostic  * All rights reserved.
42523Sdlw  *
5*47944Sbostic  * %sccs.include.proprietary.c%
623018Skre  */
723018Skre 
8*47944Sbostic #ifndef lint
9*47944Sbostic static char sccsid[] = "@(#)gerror_.c	5.3 (Berkeley) 04/12/91";
10*47944Sbostic #endif /* not lint */
11*47944Sbostic 
1223018Skre /*
132523Sdlw  * Return a standard error message in a character string.
142523Sdlw  *
152523Sdlw  * calling sequence:
162523Sdlw  *	call gerror (string)
172523Sdlw  * or
182523Sdlw  *	character*20 gerror, string
192523Sdlw  *	string = gerror()
202523Sdlw  * where:
212523Sdlw  *	'string' will receive the standard error message
222523Sdlw  */
232523Sdlw 
242523Sdlw #include	<stdio.h>
252523Sdlw #include	"../libI77/f_errno.h"
262523Sdlw 
272523Sdlw extern int sys_nerr;
282523Sdlw extern char *f_errlist[];
292523Sdlw extern int f_nerr;
302523Sdlw 
gerror_(s,len)312523Sdlw gerror_(s, len)
322523Sdlw char *s; long len;
332523Sdlw {
342523Sdlw 	char *mesg;
3542409Sbostic 	char *strerror();
362523Sdlw 
372523Sdlw 	if (errno >=0 && errno < sys_nerr)
3842409Sbostic 		mesg = strerror(errno);
392523Sdlw 	else if (errno >= F_ER && errno < (F_ER + f_nerr))
402523Sdlw 		mesg = f_errlist[errno - F_ER];
412523Sdlw 	else
422523Sdlw 		mesg = "unknown error number";
432523Sdlw 	b_char(mesg, s, len);
442523Sdlw }
45