File: mkerrcodes.c

package info (click to toggle)
libgpg-error 1.35-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 5,848 kB
  • sloc: ansic: 22,324; sh: 13,156; makefile: 488; awk: 333; lisp: 138; sed: 16
file content (78 lines) | stat: -rw-r--r-- 2,712 bytes parent folder | download | duplicates (28)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* mkerrcodes.c - Generate list of system error values.
   Copyright (C) 2004 g10 Code GmbH

   This file is part of libgpg-error.

   libgpg-error is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public License
   as published by the Free Software Foundation; either version 2.1 of
   the License, or (at your option) any later version.
 
   libgpg-error is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public
   License along with libgpg-error; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  */

/* This file must not include config.h, as that is for the host
   system, while this file will be run on the build system.  */

#include <stdio.h>

#include "mkerrcodes.h"

static const char header[] =
"/* errnos.h - List of system error values.\n"
"   Copyright (C) 2004 g10 Code GmbH\n"
"   This file is part of libgpg-error.\n"
"\n"
"   libgpg-error is free software; you can redistribute it and/or\n"
"   modify it under the terms of the GNU Lesser General Public License\n"
"   as published by the Free Software Foundation; either version 2.1 of\n"
"   the License, or (at your option) any later version.\n"
"\n"
"   libgpg-error is distributed in the hope that it will be useful, but\n"
"   WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
"   Lesser General Public License for more details.\n"
"\n"
"   You should have received a copy of the GNU Lesser General Public\n"
"   License along with libgpg-error; if not, write to the Free\n"
"   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n"
"   02111-1307, USA.  */\n"
"\n";

int
main (int argc, char **argv)
{
  int sorted;
  int i;

  printf ("%s", header);
  do
    {
      sorted = 1;
      for (i = 0; i < sizeof (err_table) / sizeof (err_table[0]) - 1; i++)
	if (err_table[i].err > err_table[i + 1].err)
	  {
	    int err = err_table[i].err;
	    const char *err_sym = err_table[i].err_sym;

	    err_table[i].err = err_table[i + 1].err;
	    err_table[i].err_sym = err_table[i + 1].err_sym;
	    err_table[i + 1].err = err;
	    err_table[i + 1].err_sym = err_sym;
	    sorted = 0;
	  }
    }
  while (!sorted);
      
  for (i = 0; i < sizeof (err_table) / sizeof (err_table[0]); i++)
    printf ("%i\t%s\n", err_table[i].err, err_table[i].err_sym);

  return 0;
}