xref: /original-bsd/usr.bin/f77/libU77/gerror_.c (revision a9c19d04)
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.1	06/07/85
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 char *sys_errlist[];
25 extern int sys_nerr;
26 extern char *f_errlist[];
27 extern int f_nerr;
28 
29 gerror_(s, len)
30 char *s; long len;
31 {
32 	char *mesg;
33 
34 	if (errno >=0 && errno < sys_nerr)
35 		mesg = sys_errlist[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