lib/errabort.c File Reference

#include "common.h"
#include "errabort.h"

Include dependency graph for errabort.c:

Go to the source code of this file.

Defines

#define maxWarnHandlers   20
#define maxAbortHandlers   12

Functions

static void defaultVaWarn (char *format, va_list args)
void vaWarn (char *format, va_list args)
void warn (char *format,...)
void errnoWarn (char *format,...)
void pushWarnHandler (WarnHandler handler)
void popWarnHandler ()
static void defaultAbort ()
void noWarnAbort ()
void vaErrAbort (char *format, va_list args)
void errAbort (char *format,...)
void errnoAbort (char *format,...)
void pushAbortHandler (AbortHandler handler)
void popAbortHandler ()
static void debugAbort ()
void pushDebugAbort ()
static void warnAbortHandler (char *format, va_list args)
void pushWarnAbort ()

Variables

static char const rcsid [] = "$Id: errabort.c,v 1.13 2004/11/10 00:10:50 markd Exp $"
static WarnHandler warnArray [maxWarnHandlers] = {defaultVaWarn,}
static int warnIx = 0
static AbortHandler abortArray [maxAbortHandlers] = {defaultAbort,}
static int abortIx = 0


Define Documentation

#define maxAbortHandlers   12

Definition at line 86 of file errabort.c.

Referenced by pushAbortHandler().

#define maxWarnHandlers   20

Definition at line 30 of file errabort.c.

Referenced by pushWarnHandler().


Function Documentation

static void debugAbort (  )  [static]

Definition at line 141 of file errabort.c.

References defaultAbort(), and FALSE.

Referenced by pushDebugAbort().

00143 {
00144 fflush(stdout);
00145 assert(FALSE);
00146 defaultAbort();
00147 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void defaultAbort (  )  [static]

Definition at line 77 of file errabort.c.

Referenced by debugAbort().

00079 {
00080 if ((getenv("ERRASSERT") != NULL) || (getenv("ERRABORT") != NULL))
00081     abort();
00082 else
00083     exit(-1);
00084 }

Here is the caller graph for this function:

static void defaultVaWarn ( char *  format,
va_list  args 
) [static]

Definition at line 20 of file errabort.c.

Referenced by warnAbortHandler().

00022 {
00023 if (format != NULL) {
00024     fflush(stdout);
00025     vfprintf(stderr, format, args);
00026     fprintf(stderr, "\n");
00027     }
00028 }

Here is the caller graph for this function:

void errAbort ( char *  format,
  ... 
)

Definition at line 105 of file errabort.c.

References vaErrAbort().

00107 {
00108 va_list args;
00109 va_start(args, format);
00110 vaErrAbort(format, args);
00111 va_end(args);
00112 }

Here is the call graph for this function:

void errnoAbort ( char *  format,
  ... 
)

Definition at line 114 of file errabort.c.

References errno, and vaErrAbort().

00116 {
00117 char fbuf[512];
00118 va_list args;
00119 va_start(args, format);
00120 sprintf(fbuf, "%s\n%s", strerror(errno), format);
00121 vaErrAbort(fbuf, args);
00122 va_end(args);
00123 }

Here is the call graph for this function:

void errnoWarn ( char *  format,
  ... 
)

Definition at line 49 of file errabort.c.

References errno, and vaWarn().

Referenced by carefulCloseWarn().

00051 {
00052 char fbuf[512];
00053 va_list args;
00054 va_start(args, format);
00055 sprintf(fbuf, "%s\n%s", strerror(errno), format);
00056 vaWarn(fbuf, args);
00057 va_end(args);
00058 }

Here is the call graph for this function:

Here is the caller graph for this function:

void noWarnAbort (  ) 

Definition at line 90 of file errabort.c.

References abortArray, and abortIx.

Referenced by carefulClose(), htmlPageParseOk(), netLineFileOpen(), netMustConnect(), netRecieveHugeString(), netRecieveLongString(), netRecieveString(), perr(), rudpMustOpen(), rudpMustOpenBound(), tagAbort(), vaErrAbort(), and warnAbortHandler().

00092 {
00093 abortArray[abortIx]();
00094 exit(-1);               /* This is just to make compiler happy. 
00095                          * We have already exited or longjmped by now. */
00096 }

Here is the caller graph for this function:

void popAbortHandler (  ) 

Definition at line 133 of file errabort.c.

References abortIx, and errAbort().

Referenced by cgiParseInput(), errCatchEnd(), errorSafeCleanupMess(), errorSafePcr(), errorSafeQuery(), ffFind(), htmEmptyShell(), and snofDupeOkIndex().

00135 {
00136 if (abortIx <= 0)
00137     errAbort("Too many popAbortHandlers\n");
00138 --abortIx;
00139 }

Here is the call graph for this function:

Here is the caller graph for this function:

void popWarnHandler (  ) 

Definition at line 69 of file errabort.c.

References errAbort(), and warnIx.

Referenced by errCatchEnd(), and htmEmptyShell().

00071 {
00072 if (warnIx <= 0)
00073     errAbort("Too many popWarnHandlers\n");
00074 --warnIx;
00075 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pushAbortHandler ( AbortHandler  handler  ) 

Definition at line 125 of file errabort.c.

References abortArray, abortIx, errAbort(), and maxAbortHandlers.

Referenced by cgiParseInput(), errCatchPushHandlers(), errorSafeSetup(), ffFind(), htmEmptyShell(), htmlPushEarlyHandlers(), logOpenFile(), logOpenSyslog(), plProcSetup(), pushDebugAbort(), snofDupeOkIndex(), and textOutInit().

00127 {
00128 if (abortIx >= maxAbortHandlers-1)
00129     errAbort("Too many pushAbortHandlers, can only handle %d\n", maxAbortHandlers-1);
00130 abortArray[++abortIx] = handler;
00131 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pushDebugAbort (  ) 

Definition at line 149 of file errabort.c.

References debugAbort(), and pushAbortHandler().

00151 {
00152 pushAbortHandler(debugAbort);
00153 }

Here is the call graph for this function:

void pushWarnAbort (  ) 

Definition at line 162 of file errabort.c.

References pushWarnHandler(), and warnAbortHandler().

Referenced by plProcSetup().

00164 {
00165 pushWarnHandler(warnAbortHandler);
00166 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pushWarnHandler ( WarnHandler  handler  ) 

Definition at line 61 of file errabort.c.

References errAbort(), maxWarnHandlers, warnArray, and warnIx.

Referenced by errCatchPushHandlers(), htmEmptyShell(), htmlPushEarlyHandlers(), logOpenFile(), logOpenSyslog(), pushWarnAbort(), and textOutInit().

00063 {
00064 if (warnIx >= maxWarnHandlers-1)
00065     errAbort("Too many pushWarnHandlers, can only handle %d\n", maxWarnHandlers-1);
00066 warnArray[++warnIx] = handler;
00067 }

Here is the call graph for this function:

Here is the caller graph for this function:

void vaErrAbort ( char *  format,
va_list  args 
)

Definition at line 98 of file errabort.c.

References noWarnAbort(), and vaWarn().

Referenced by errAbort(), and errnoAbort().

00100 {
00101 vaWarn(format, args);
00102 noWarnAbort();
00103 }

Here is the call graph for this function:

Here is the caller graph for this function:

void vaWarn ( char *  format,
va_list  args 
)

Definition at line 34 of file errabort.c.

References warnArray, and warnIx.

Referenced by errnoWarn(), parseErr(), qaStatusSoftError(), tagVaWarn(), tokenizerErrAbort(), vaErrAbort(), warn(), xapError(), and xpError().

00036 {
00037 warnArray[warnIx](format, args);
00038 }

Here is the caller graph for this function:

void warn ( char *  format,
  ... 
)

Definition at line 40 of file errabort.c.

References vaWarn().

00042 {
00043 va_list args;
00044 va_start(args, format);
00045 vaWarn(format, args);
00046 va_end(args);
00047 }

Here is the call graph for this function:

static void warnAbortHandler ( char *  format,
va_list  args 
) [static]

Definition at line 155 of file errabort.c.

References defaultVaWarn(), and noWarnAbort().

Referenced by pushWarnAbort().

00157 {
00158 defaultVaWarn(format, args);
00159 noWarnAbort();
00160 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

AbortHandler abortArray[maxAbortHandlers] = {defaultAbort,} [static]

Definition at line 87 of file errabort.c.

Referenced by noWarnAbort(), and pushAbortHandler().

int abortIx = 0 [static]

Definition at line 88 of file errabort.c.

Referenced by noWarnAbort(), popAbortHandler(), and pushAbortHandler().

char const rcsid[] = "$Id: errabort.c,v 1.13 2004/11/10 00:10:50 markd Exp $" [static]

Definition at line 18 of file errabort.c.

WarnHandler warnArray[maxWarnHandlers] = {defaultVaWarn,} [static]

Definition at line 31 of file errabort.c.

Referenced by pushWarnHandler(), and vaWarn().

int warnIx = 0 [static]

Definition at line 32 of file errabort.c.

Referenced by popWarnHandler(), pushWarnHandler(), and vaWarn().


Generated on Tue Dec 25 19:48:13 2007 for blat by  doxygen 1.5.2