xref: /original-bsd/usr.bin/f77/libU77/gerror_.c (revision 3b6250d9)
1 /*-
2  * Copyright (c) 1980 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)gerror_.c	5.3 (Berkeley) 04/12/91";
10 #endif /* not lint */
11 
12 /*
13  * Return a standard error message in a character string.
14  *
15  * calling sequence:
16  *	call gerror (string)
17  * or
18  *	character*20 gerror, string
19  *	string = gerror()
20  * where:
21  *	'string' will receive the standard error message
22  */
23 
24 #include	<stdio.h>
25 #include	"../libI77/f_errno.h"
26 
27 extern int sys_nerr;
28 extern char *f_errlist[];
29 extern int f_nerr;
30 
31 gerror_(s, len)
32 char *s; long len;
33 {
34 	char *mesg;
35 	char *strerror();
36 
37 	if (errno >=0 && errno < sys_nerr)
38 		mesg = strerror(errno);
39 	else if (errno >= F_ER && errno < (F_ER + f_nerr))
40 		mesg = f_errlist[errno - F_ER];
41 	else
42 		mesg = "unknown error number";
43 	b_char(mesg, s, len);
44 }
45