5 * DIGITAL EQUIPMENT CORPORATION
6 * MAYNARD, MASSACHUSETTS
9 * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
10 * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
11 * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
12 * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
15 * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
16 * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
17 * ADDITION TO THAT SET FORTH ABOVE.
19 * Permission to use, copy, modify, and distribute this software and its
20 * documentation for any purpose and without fee is hereby granted, provided
21 * that the above copyright notice appear in all copies and that both that
22 * copyright notice and this permission notice appear in supporting
23 * documentation, and that the name of Digital Equipment Corporation not be
24 * used in advertising or publicity pertaining to distribution of the
25 * software without specific, written prior permission.
28 #define DEBUG_VAR_LOCAL
33 unsigned int DEBUG_VAR;
35 /***====================================================================***/
36 /*** FUNCTION ENTRY TRACKING ***/
37 /***====================================================================***/
39 static FILE *entryFile= NULL;
40 static int uEntryLevel;
43 uSetEntryFile(const char *name)
45 if ((entryFile!=NULL)&&(entryFile!=stderr)) {
46 fprintf(entryFile,"switching to %s\n",name?name:"stderr");
49 if (name!=NullString) entryFile= fopen(name,"w");
50 else entryFile= stderr;
51 if (entryFile==NULL) {
59 uEntry(int l, const char *s,...)
65 for (i=0;i<uEntryLevel;i++) {
68 vfprintf(entryFile,s,ap);
75 uExit(int l, const char *rtVal)
80 if (uEntryLevel<0) uEntryLevel= 0;
81 for (i=0;i<uEntryLevel;i++) {
84 fprintf(entryFile,"---> 0x%p\n",rtVal);
88 /***====================================================================***/
89 /*** PRINT FUNCTIONS ***/
90 /***====================================================================***/
92 FILE *uDebugFile= NULL;
93 int uDebugIndentLevel= 0;
94 int uDebugIndentSize= 4;
97 uSetDebugFile(const char *name)
99 if ((uDebugFile!=NULL)&&(uDebugFile!=stderr)) {
100 fprintf(uDebugFile,"switching to %s\n",name?name:"stderr");
103 if (name!=NullString) uDebugFile= fopen(name,"w");
104 else uDebugFile= stderr;
105 if (uDebugFile==NULL) {
113 uDebug(const char *s,...)
119 for (i=(uDebugIndentLevel*uDebugIndentSize);i>0;i--) {
120 putc(' ',uDebugFile);
122 vfprintf(uDebugFile,s,ap);
129 uDebugNOI(const char *s,...)
134 vfprintf(uDebugFile,s,ap);
140 /***====================================================================***/
142 static FILE *errorFile= NULL;
145 uSetErrorFile(const char *name)
147 if ((errorFile!=NULL)&&(errorFile!=stderr)) {
148 fprintf(errorFile,"switching to %s\n",name?name:"stderr");
151 if (name!=NullString) errorFile= fopen(name,"w");
152 else errorFile= stderr;
153 if (errorFile==NULL) {
161 uInformation(const char *s,...)
166 vfprintf(errorFile,s,ap);
172 /***====================================================================***/
175 uAction(const char *s,...)
180 fprintf(errorFile," ");
181 vfprintf(errorFile,s,ap);
187 /***====================================================================***/
190 uWarning(const char *s,...)
195 fprintf(errorFile,"Warning: ");
196 vfprintf(errorFile,s,ap);
202 /***====================================================================***/
205 uError(const char *s,...)
210 fprintf(errorFile,"Error: ");
211 vfprintf(errorFile,s,ap);
217 /***====================================================================***/
220 uInternalError(const char *s,...)
225 fprintf(errorFile,"Internal error: ");
226 vfprintf(errorFile,s,ap);
232 /***====================================================================***/
234 #ifndef HAVE_STRCASECMP
236 uStrCaseCmp(const char *str1, const char *str2)
238 char buf1[512],buf2[512];
242 for (n=0, s = buf1; (c = *str1++); n++) {
250 for (n=0, s = buf2; (c = *str2++); n++) {
258 return (strcmp(buf1, buf2));
262 uStrCasePrefix(const char *prefix, const char *str)
266 while (((c1=*prefix)!='\0')&&((c2=*str)!='\0')) {
267 if (isupper(c1)) c1= tolower(c1);
268 if (isupper(c2)) c2= tolower(c2);