00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "copyright.h"
00010 #include "utility.h"
00011
00012
00013
00014 #ifdef HOST_SNAKE
00015 #include <stdarg.h>
00016 #else
00017 #ifdef HOST_SPARC
00018 #include <stdarg.h>
00019 #else
00020 #include "/usr/include/stdarg.h"
00021 #endif
00022 #endif
00023
00024 static char *enableFlags = NULL;
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 void
00038 DebugInit(char *flagList)
00039 {
00040 enableFlags = flagList;
00041 }
00042
00043
00044
00045
00046
00047
00048 bool
00049 DebugIsEnabled(char flag)
00050 {
00051 if (enableFlags != NULL)
00052 return (strchr(enableFlags, flag) != 0)
00053 || (strchr(enableFlags, '+') != 0);
00054 else
00055 return FALSE;
00056 }
00057
00058
00059
00060
00061
00062
00063
00064 void
00065 DEBUG(char flag, char *format, ...)
00066 {
00067 if (DebugIsEnabled(flag)) {
00068 va_list ap;
00069
00070 va_start(ap, format);
00071 vfprintf(stdout, format, ap);
00072 va_end(ap);
00073 fflush(stdout);
00074 }
00075 }
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees