xref: /openbsd-src/gnu/usr.bin/texinfo/lib/strerror.c (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1 /*
2  * strerror.c --- ANSI C compatible system error routine
3  */
4 
5 /*
6  * Copyright (C) 1986, 1988, 1989, 1991 the Free Software Foundation, Inc.
7  * From gawk.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  *
23  */
24 
25 #if 0
26 #include <stdio.h>
27 #endif
28 
29 extern int sys_nerr;
30 extern char *sys_errlist[];
31 
32 char *
33 strerror(n)
34 int n;
35 {
36 	static char mesg[30];
37 
38 	if (n < 0 || n >= sys_nerr) {
39 		sprintf(mesg, "Unknown error (%d)", n);
40 		return mesg;
41 	} else
42 		return sys_errlist[n];
43 }
44