Adjusted.
[glibc.git] / sysdeps / unix / make_errlist.c
blobb73b15230a0041f13b1615ad525f5ee93daf1cc9
1 /* Copyright (C) 1991, 1992, 1995, 1997, 1999 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>
20 #include <time.h>
22 /* Make a definition for sys_errlist. */
24 extern int sys_nerr;
25 #ifndef HAVE_STRERROR
26 extern char *sys_errlist[];
27 #endif
29 int
30 main ()
32 register int i;
33 struct tm timenow;
34 time_t now;
35 int year;
37 now = time(NULL);
38 timenow = *localtime(&now);
40 year = timenow.tm_year + 1900;
42 printf ("/* Copyright (C) %d Free Software Foundation, Inc.\n\
43 This file is part of the GNU C Library.\n\
44 \n\
45 The GNU C Library is free software; you can redistribute it and/or\n\
46 modify it under the terms of the GNU Library General Public License as\n\
47 published by the Free Software Foundation; either version 2 of the\n\
48 License, or (at your option) any later version.\n\
49 \n\
50 The GNU C Library is distributed in the hope that it will be useful,\n\
51 but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
52 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\
53 Library General Public License for more details.\n\
54 \n\
55 You should have received a copy of the GNU Library General Public\n\
56 License along with the GNU C Library; see the file COPYING.LIB. If not,\n\
57 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n\
58 Boston, MA 02111-1307, USA. */\n\n", year);
60 puts ("#include <stddef.h>\n");
61 puts ("#include <libintl.h>\n");
62 puts ("\n/* This is a list of all known `errno' codes. */\n");
64 printf ("\nconst int _sys_nerr = %d;\n\n", sys_nerr);
65 puts ("const char *const _sys_errlist[] =\n {");
67 for (i = 0; i < sys_nerr; ++i)
68 printf (" N_(\"%s\"),\n",
69 #ifdef HAVE_STRERROR
70 strerror (i)
71 #else /* ! HAVE_STRERROR */
72 sys_errlist[i]
73 #endif /* HAVE_STRERROR */
76 puts (" NULL\n };\n");
78 puts ("weak_alias (_sys_errlist, sys_errlist)");
79 puts ("weak_alias (_sys_nerr, sys_nerr)");
81 exit (0);