View | Details | Raw Unified | Return to bug 34636
Collapse All | Expand All

(-)./work/XmHTML-1.1.7/lib/common/debug.c (-7 / +15 lines)
Lines 110-116 Link Here
110
/*** Private Function Prototype Declarations ****/
110
/*** Private Function Prototype Declarations ****/
111
111
112
/*** Private Variable Declarations ***/
112
/*** Private Variable Declarations ***/
113
static FILE *__rsd_debug_file = stdout;
113
static FILE *__rsd_debug_file;
114
114
115
/*****
115
/*****
116
* When debug output is send to a file, we register an exit func to close
116
* When debug output is send to a file, we register an exit func to close
Lines 128-134 Link Here
128
#endif
128
#endif
129
{
129
{
130
	/* close output file */
130
	/* close output file */
131
	fclose(__rsd_debug_file);
131
	if (__rsd_debug_file) {
132
		fclose(__rsd_debug_file);
133
		__rsd_debug_file = NULL;
134
	}
135
	
132
}
136
}
133
137
134
/*****
138
/*****
Lines 146-151 Link Here
146
#ifdef __STDC__
150
#ifdef __STDC__
147
__rsd_fprintf(char *fmt, ...) 
151
__rsd_fprintf(char *fmt, ...) 
148
{
152
{
153
	register FILE *fp = (__rsd_debug_file ? __rsd_debug_file : stdout);
149
	va_list arg_list;
154
	va_list arg_list;
150
	va_start(arg_list, fmt);
155
	va_start(arg_list, fmt);
151
156
Lines 155-169 Link Here
155
    char *fmt;
160
    char *fmt;
156
    va_dcl
161
    va_dcl
157
{
162
{
163
	register FILE *fp = (__rsd_debug_file ? __rsd_debug_file : stdout);
158
	va_list arg_list;
164
	va_list arg_list;
159
	va_start(arg_list);
165
	va_start(arg_list);
160
#endif /* __STDC__ */
166
#endif /* __STDC__ */
161
167
162
	/* flush to file */
168
	/* flush to file */
163
	vfprintf(__rsd_debug_file, fmt, arg_list);
169
	vfprintf(fp, fmt, arg_list);
164
	va_end(arg_list);
170
	va_end(arg_list);
165
171
166
	fflush(__rsd_debug_file);
172
	fflush(fp);
167
}
173
}
168
174
169
/*****
175
/*****
Lines 298-305 Link Here
298
				if((chPtr = strstr(argv[i], ":")) != NULL)
304
				if((chPtr = strstr(argv[i], ":")) != NULL)
299
				{
305
				{
300
					/* close any existing output file */
306
					/* close any existing output file */
301
					if(__rsd_debug_file != stdout)
307
					if(__rsd_debug_file) {
302
						fclose(__rsd_debug_file);
308
						fclose(__rsd_debug_file);
309
						__rsd_debug_file = NULL;
310
					}
303
311
304
					chPtr++;	/* skip : */
312
					chPtr++;	/* skip : */
305
					if(!strcmp(chPtr, "pid"))	/* <pid>.out */
313
					if(!strcmp(chPtr, "pid"))	/* <pid>.out */
Lines 336-349 Link Here
336
						fprintf(stderr, "__rsd_setDebugLevels: failed to open "
344
						fprintf(stderr, "__rsd_setDebugLevels: failed to open "
337
							"output file %s (errno = %i), reverting to "
345
							"output file %s (errno = %i), reverting to "
338
							"stdout\n", tmp, errno);
346
							"stdout\n", tmp, errno);
339
						__rsd_debug_file = stdout;
347
						__rsd_debug_file = NULL;
340
					}
348
					}
341
				}
349
				}
342
				else
350
				else
343
				{
351
				{
344
					fprintf(stderr, "__rsd_setDebugLevels: missing arg to "
352
					fprintf(stderr, "__rsd_setDebugLevels: missing arg to "
345
						"-dfile:, reverting to stdout\n");
353
						"-dfile:, reverting to stdout\n");
346
					__rsd_debug_file = stdout;
354
					__rsd_debug_file = NULL;
347
				}
355
				}
348
				/* remove from cmd line */
356
				/* remove from cmd line */
349
				REMOVE_ARG;
357
				REMOVE_ARG;

Return to bug 34636