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.
29 #include "XKBcommonint.h"
37 recalloc(void * old, unsigned nOld, unsigned nNew, unsigned itemSize)
42 rtrn = calloc(nNew, itemSize);
45 rtrn = realloc(old, nNew * itemSize);
46 if ((rtrn) && (nNew > nOld))
48 memset(&rtrn[nOld * itemSize], 0, (nNew - nOld) * itemSize);
54 static FILE *errorFile = NULL;
55 static int outCount = 0;
56 static char *preMsg = NULL;
57 static char *prefix = NULL;
60 uSetErrorFile(char *name)
62 if ((errorFile != NULL) && (errorFile != stderr))
64 fprintf(errorFile, "switching to %s\n", name ? name : "stderr");
68 errorFile = fopen(name, "w");
71 if (errorFile == NULL)
80 uInformation(const char *s, ...)
88 vfprintf(errorFile, s, args);
93 /***====================================================================***/
96 uAction(const char *s, ...)
104 fprintf(errorFile, "%s", prefix);
105 fprintf(errorFile, " ");
107 vfprintf(errorFile, s, args);
112 /***====================================================================***/
115 uWarning(const char *s, ...)
122 if ((outCount == 0) && (preMsg != NULL))
123 fprintf(errorFile, "%s\n", preMsg);
125 fprintf(errorFile, "%s", prefix);
126 fprintf(errorFile, "Warning: ");
128 vfprintf(errorFile, s, args);
134 /***====================================================================***/
137 uError(const char *s, ...)
144 if ((outCount == 0) && (preMsg != NULL))
145 fprintf(errorFile, "%s\n", preMsg);
147 fprintf(errorFile, "%s", prefix);
148 fprintf(errorFile, "Error: ");
150 vfprintf(errorFile, s, args);
156 /***====================================================================***/
159 uFatalError(const char *s, ...)
166 if ((outCount == 0) && (preMsg != NULL))
167 fprintf(errorFile, "%s\n", preMsg);
169 fprintf(errorFile, "%s", prefix);
170 fprintf(errorFile, "Fatal Error: ");
172 vfprintf(errorFile, s, args);
174 fprintf(errorFile, " Exiting\n");
181 /***====================================================================***/
184 uInternalError(const char *s, ...)
191 if ((outCount == 0) && (preMsg != NULL))
192 fprintf(errorFile, "%s\n", preMsg);
194 fprintf(errorFile, "%s", prefix);
195 fprintf(errorFile, "Internal error: ");
197 vfprintf(errorFile, s, args);