xref: /csrg-svn/usr.bin/f77/libU77/gerror_.c (revision 23018)
12523Sdlw /*
2*23018Skre  * Copyright (c) 1980 Regents of the University of California.
3*23018Skre  * All rights reserved.  The Berkeley software License Agreement
4*23018Skre  * specifies the terms and conditions for redistribution.
52523Sdlw  *
6*23018Skre  *	@(#)gerror_.c	5.1	06/07/85
7*23018Skre  */
8*23018Skre 
9*23018Skre /*
102523Sdlw  * Return a standard error message in a character string.
112523Sdlw  *
122523Sdlw  * calling sequence:
132523Sdlw  *	call gerror (string)
142523Sdlw  * or
152523Sdlw  *	character*20 gerror, string
162523Sdlw  *	string = gerror()
172523Sdlw  * where:
182523Sdlw  *	'string' will receive the standard error message
192523Sdlw  */
202523Sdlw 
212523Sdlw #include	<stdio.h>
222523Sdlw #include	"../libI77/f_errno.h"
232523Sdlw 
242523Sdlw extern char *sys_errlist[];
252523Sdlw extern int sys_nerr;
262523Sdlw extern char *f_errlist[];
272523Sdlw extern int f_nerr;
282523Sdlw 
292523Sdlw gerror_(s, len)
302523Sdlw char *s; long len;
312523Sdlw {
322523Sdlw 	char *mesg;
332523Sdlw 
342523Sdlw 	if (errno >=0 && errno < sys_nerr)
352523Sdlw 		mesg = sys_errlist[errno];
362523Sdlw 	else if (errno >= F_ER && errno < (F_ER + f_nerr))
372523Sdlw 		mesg = f_errlist[errno - F_ER];
382523Sdlw 	else
392523Sdlw 		mesg = "unknown error number";
402523Sdlw 	b_char(mesg, s, len);
412523Sdlw }
42