4 * Error messages and handling
6 * © 1994-1998 Straylight
9 /*----- Licensing note ----------------------------------------------------*
11 * This file is part of Straylight's Dynamic Linking System (SDLS)
13 * SDLS is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
18 * SDLS is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with SDLS. If not, write to the Free Software Foundation,
25 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #define error__MAKETABLE
36 static char *error__progname;
37 static int error__count[5];
38 static int error__retcode=0;
40 void error_setProgName(char *name)
42 error__progname=strrchr(name,'.');
49 char *error_progname(void)
51 return (error__progname);
54 void error(int message,...)
56 static char const *types[]={"Informational",
67 types[error__table[message].sev]);
68 vfprintf(stderr,error__table[message].msg,ap);
70 if (error__table[message].sev==error_FATAL)
72 error__count[error__table[message].sev]++;
73 if (error__table[message].sev>error__retcode)
74 error__retcode=error__table[message].sev;
82 "%s: completed with %i warning%s, "
83 "%i error%s and %i serious error%s.\n",
85 error__count[error_WARN],
86 error__count[error_WARN]==1 ? "" : "s",
87 error__count[error_ERROR],
88 error__count[error_ERROR]==1 ? "" : "s",
89 error__count[error_SEVERE],
90 error__count[error_SEVERE]==1 ? "" : "s");
94 int error_returnCode(void)
96 return (error__retcode);
99 extern void aof_error(void)