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.
36 recalloc(void *ptr, size_t old_size, size_t new_size)
41 return calloc(1, new_size);
43 rtrn = realloc(ptr, new_size);
44 if (rtrn && new_size > old_size)
45 memset(&rtrn[old_size], 0, new_size - old_size);
50 static FILE *errorFile = NULL;
51 static int outCount = 0;
52 static char *preMsg = NULL;
53 static char *prefix = NULL;
56 uSetErrorFile(char *name)
58 if ((errorFile != NULL) && (errorFile != stderr))
60 fprintf(errorFile, "switching to %s\n", name ? name : "stderr");
64 errorFile = fopen(name, "w");
67 if (errorFile == NULL)
76 uInformation(const char *s, ...)
84 vfprintf(errorFile, s, args);
89 /***====================================================================***/
92 uAction(const char *s, ...)
100 fprintf(errorFile, "%s", prefix);
101 fprintf(errorFile, " ");
103 vfprintf(errorFile, s, args);
108 /***====================================================================***/
111 uWarning(const char *s, ...)
118 if ((outCount == 0) && (preMsg != NULL))
119 fprintf(errorFile, "%s\n", preMsg);
121 fprintf(errorFile, "%s", prefix);
122 fprintf(errorFile, "Warning: ");
124 vfprintf(errorFile, s, args);
130 /***====================================================================***/
133 uError(const char *s, ...)
140 if ((outCount == 0) && (preMsg != NULL))
141 fprintf(errorFile, "%s\n", preMsg);
143 fprintf(errorFile, "%s", prefix);
144 fprintf(errorFile, "Error: ");
146 vfprintf(errorFile, s, args);
152 /***====================================================================***/
155 uFatalError(const char *s, ...)
162 if ((outCount == 0) && (preMsg != NULL))
163 fprintf(errorFile, "%s\n", preMsg);
165 fprintf(errorFile, "%s", prefix);
166 fprintf(errorFile, "Fatal Error: ");
168 vfprintf(errorFile, s, args);
170 fprintf(errorFile, " Exiting\n");
177 /***====================================================================***/
180 uInternalError(const char *s, ...)
187 if ((outCount == 0) && (preMsg != NULL))
188 fprintf(errorFile, "%s\n", preMsg);
190 fprintf(errorFile, "%s", prefix);
191 fprintf(errorFile, "Internal error: ");
193 vfprintf(errorFile, s, args);