Blame src/mkerrcodes.c

Packit fc043f
/* mkerrcodes.c - Generate list of system error values.
Packit fc043f
   Copyright (C) 2004 g10 Code GmbH
Packit fc043f
Packit fc043f
   This file is part of libgpg-error.
Packit fc043f
Packit fc043f
   libgpg-error is free software; you can redistribute it and/or
Packit fc043f
   modify it under the terms of the GNU Lesser General Public License
Packit fc043f
   as published by the Free Software Foundation; either version 2.1 of
Packit fc043f
   the License, or (at your option) any later version.
Packit fc043f
 
Packit fc043f
   libgpg-error is distributed in the hope that it will be useful, but
Packit fc043f
   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit fc043f
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit fc043f
   Lesser General Public License for more details.
Packit fc043f
 
Packit fc043f
   You should have received a copy of the GNU Lesser General Public
Packit fc043f
   License along with libgpg-error; if not, write to the Free
Packit fc043f
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
Packit fc043f
   02111-1307, USA.  */
Packit fc043f
Packit fc043f
/* This file must not include config.h, as that is for the host
Packit fc043f
   system, while this file will be run on the build system.  */
Packit fc043f
Packit fc043f
#include <stdio.h>
Packit fc043f
Packit fc043f
#include "mkerrcodes.h"
Packit fc043f
Packit fc043f
static const char header[] =
Packit fc043f
"/* errnos.h - List of system error values.\n"
Packit fc043f
"   Copyright (C) 2004 g10 Code GmbH\n"
Packit fc043f
"   This file is part of libgpg-error.\n"
Packit fc043f
"\n"
Packit fc043f
"   libgpg-error is free software; you can redistribute it and/or\n"
Packit fc043f
"   modify it under the terms of the GNU Lesser General Public License\n"
Packit fc043f
"   as published by the Free Software Foundation; either version 2.1 of\n"
Packit fc043f
"   the License, or (at your option) any later version.\n"
Packit fc043f
"\n"
Packit fc043f
"   libgpg-error is distributed in the hope that it will be useful, but\n"
Packit fc043f
"   WITHOUT ANY WARRANTY; without even the implied warranty of\n"
Packit fc043f
"   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
Packit fc043f
"   Lesser General Public License for more details.\n"
Packit fc043f
"\n"
Packit fc043f
"   You should have received a copy of the GNU Lesser General Public\n"
Packit fc043f
"   License along with libgpg-error; if not, write to the Free\n"
Packit fc043f
"   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n"
Packit fc043f
"   02111-1307, USA.  */\n"
Packit fc043f
"\n";
Packit fc043f
Packit fc043f
int
Packit fc043f
main (int argc, char **argv)
Packit fc043f
{
Packit fc043f
  int sorted;
Packit fc043f
  int i;
Packit fc043f
Packit fc043f
  printf ("%s", header);
Packit fc043f
  do
Packit fc043f
    {
Packit fc043f
      sorted = 1;
Packit fc043f
      for (i = 0; i < sizeof (err_table) / sizeof (err_table[0]) - 1; i++)
Packit fc043f
	if (err_table[i].err > err_table[i + 1].err)
Packit fc043f
	  {
Packit fc043f
	    int err = err_table[i].err;
Packit fc043f
	    const char *err_sym = err_table[i].err_sym;
Packit fc043f
Packit fc043f
	    err_table[i].err = err_table[i + 1].err;
Packit fc043f
	    err_table[i].err_sym = err_table[i + 1].err_sym;
Packit fc043f
	    err_table[i + 1].err = err;
Packit fc043f
	    err_table[i + 1].err_sym = err_sym;
Packit fc043f
	    sorted = 0;
Packit fc043f
	  }
Packit fc043f
    }
Packit fc043f
  while (!sorted);
Packit fc043f
      
Packit fc043f
  for (i = 0; i < sizeof (err_table) / sizeof (err_table[0]); i++)
Packit fc043f
    printf ("%i\t%s\n", err_table[i].err, err_table[i].err_sym);
Packit fc043f
Packit fc043f
  return 0;
Packit fc043f
}