ARPDAS_QNX6 1.0
|
00001 /* nl_verr.c contains nl_verror() which allows easy expansion of 00002 * the nl_error capabilities in many cases. 00003 */ 00004 #include <stdio.h> 00005 #include <stdlib.h> 00006 #include <stdarg.h> 00007 #include "nortlib.h" 00008 char rcsid_nl_verr_c[] = 00009 "$Header: /cvsroot/arp-das/nortlib2/src/nl_verr.c,v 1.4 1998/01/06 18:36:56 nort Done $"; 00010 00011 int nl_verror(FILE *ef, int level, const char *fmt, va_list args) { 00012 char *lvlmsg; 00013 00014 if (level < -1 && nl_debug_level > level) return(level); 00015 switch (level) { 00016 case -1: lvlmsg = ""; break; 00017 case 0: lvlmsg = ""; break; 00018 case 1: lvlmsg = "Warning: "; break; 00019 case 2: lvlmsg = "Error: "; break; 00020 case 3: lvlmsg = "Fatal: "; break; 00021 default: 00022 if (level <= -2) lvlmsg = "Debug: "; 00023 else lvlmsg = "Internal: "; 00024 break; 00025 } 00026 fprintf(ef, "%s", lvlmsg); 00027 vfprintf(ef, fmt, args); 00028 fputc('\n', ef); 00029 if (level > 3 ) { 00030 fflush( ef ); 00031 abort(); 00032 } 00033 if (level > 2 || level == -1) exit(level > 0 ? level : 0); 00034 return(level); 00035 } 00036 /* 00037 =Name nl_verror(): stdarg-style error message routine 00038 =Subject Nortlib 00039 =Synopsis 00040 00041 #include <stdarg.h> 00042 #include "nortlib.h" 00043 int nl_verror(FILE *ef, int level, const char *fmt, va_list args); 00044 00045 =Description 00046 00047 nl_verror() provides the same error message functionality as 00048 =nl_err=() but with stdarg.h-style arguments. (nl_err() is 00049 actually implemented by calling nl_verror()). This makes is 00050 possible to create error message functions that do a little more 00051 work on the message and then call nl_verror() to do the final 00052 processing. =compile_error=() is written this way in order to 00053 output the current input filename and line number before each 00054 message. 00055 00056 =Returns 00057 00058 The level argument unless level dictates termination. 00059 00060 =SeeAlso 00061 00062 =nl_error=(), =nl_err=(), =nl_response=, =set_response=(). 00063 00064 =End 00065 */