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