1 /* mkerrcodes.c - Generate list of system error values.
2 Copyright (C) 2004 g10 Code GmbH
4 This file is part of libgpg-error.
6 libgpg-error is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public License
8 as published by the Free Software Foundation; either version 2.1 of
9 the License, or (at your option) any later version.
11 libgpg-error is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with libgpg-error; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 /* This file must not include config.h, as that is for the host
22 system, while this file will be run on the build system. */
26 #include "mkerrcodes.h"
28 static const char header[] =
29 "/* errnos.h - List of system error values.\n"
30 " Copyright (C) 2004 g10 Code GmbH\n"
31 " This file is part of libgpg-error.\n"
33 " libgpg-error is free software; you can redistribute it and/or\n"
34 " modify it under the terms of the GNU Lesser General Public License\n"
35 " as published by the Free Software Foundation; either version 2.1 of\n"
36 " the License, or (at your option) any later version.\n"
38 " libgpg-error is distributed in the hope that it will be useful, but\n"
39 " WITHOUT ANY WARRANTY; without even the implied warranty of\n"
40 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
41 " Lesser General Public License for more details.\n"
43 " You should have received a copy of the GNU Lesser General Public\n"
44 " License along with libgpg-error; if not, write to the Free\n"
45 " Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n"
46 " 02111-1307, USA. */\n"
50 main (int argc, char **argv)
55 printf ("%s", header);
59 for (i = 0; i < sizeof (err_table) / sizeof (err_table[0]) - 1; i++)
60 if (err_table[i].err > err_table[i + 1].err)
62 int err = err_table[i].err;
63 const char *err_sym = err_table[i].err_sym;
65 err_table[i].err = err_table[i + 1].err;
66 err_table[i].err_sym = err_table[i + 1].err_sym;
67 err_table[i + 1].err = err;
68 err_table[i + 1].err_sym = err_sym;
74 for (i = 0; i < sizeof (err_table) / sizeof (err_table[0]); i++)
75 printf ("%i\t%s\n", err_table[i].err, err_table[i].err_sym);