Tizen 2.1 base
[external/libgpg-error.git] / src / mkerrcodes.c
1 /* mkerrcodes.c - Generate list of system error values.
2    Copyright (C) 2004 g10 Code GmbH
3
4    This file is part of libgpg-error.
5
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.
10  
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.
15  
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
19    02111-1307, USA.  */
20
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.  */
23
24 #include <stdio.h>
25
26 #include "mkerrcodes.h"
27
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"
32 "\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"
37 "\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"
42 "\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"
47 "\n";
48
49 int
50 main (int argc, char **argv)
51 {
52   int sorted;
53   int i;
54
55   printf ("%s", header);
56   do
57     {
58       sorted = 1;
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)
61           {
62             int err = err_table[i].err;
63             const char *err_sym = err_table[i].err_sym;
64
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;
69             sorted = 0;
70           }
71     }
72   while (!sorted);
73       
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);
76
77   return 0;
78 }