xref: /csrg-svn/usr.bin/f77/libU77/gerror_.c (revision 42409)
12523Sdlw /*
223018Skre  * Copyright (c) 1980 Regents of the University of California.
323018Skre  * All rights reserved.  The Berkeley software License Agreement
423018Skre  * specifies the terms and conditions for redistribution.
52523Sdlw  *
6*42409Sbostic  *	@(#)gerror_.c	5.2	05/28/90
723018Skre  */
823018Skre 
923018Skre /*
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 int sys_nerr;
252523Sdlw extern char *f_errlist[];
262523Sdlw extern int f_nerr;
272523Sdlw 
282523Sdlw gerror_(s, len)
292523Sdlw char *s; long len;
302523Sdlw {
312523Sdlw 	char *mesg;
32*42409Sbostic 	char *strerror();
332523Sdlw 
342523Sdlw 	if (errno >=0 && errno < sys_nerr)
35*42409Sbostic 		mesg = strerror(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