1998-10-24 Roland McGrath <roland@baalperazim.frob.com>
[glibc.git] / sysdeps / unix / make_errlist.c
blob8d927561449b426969ebae65b682d2c616f38bd4
1 /* Copyright (C) 1991, 1992, 1995, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #include <stdio.h>
21 /* Make a definition for sys_errlist. */
23 extern int sys_nerr;
24 #ifndef HAVE_STRERROR
25 extern char *sys_errlist[];
26 #endif
28 int
29 main ()
31 register int i;
33 puts ("#include <stddef.h>\n");
34 puts ("\n/* This is a list of all known `errno' codes. */\n");
36 printf ("\nconst int _sys_nerr = %d;\n\n", sys_nerr);
37 puts ("const char *const _sys_errlist[] =\n {");
39 for (i = 0; i < sys_nerr; ++i)
40 printf (" \"%s\",\n",
41 #ifdef HAVE_STRERROR
42 strerror (i)
43 #else /* ! HAVE_STRERROR */
44 sys_errlist[i]
45 #endif /* HAVE_STRERROR */
48 puts (" NULL\n };\n");
50 puts ("weak_alias (_sys_errlist, sys_errlist)");
51 puts ("weak_alias (_sys_nerr, sys_nerr)");
53 exit (0);