freebsd-ports/x11-toolkits/xmhtml/files/patch-ai

81 lines
1.9 KiB
Text
Raw Normal View History

--- lib/common/debug.c.old Tue Oct 6 21:58:00 1998
+++ lib/common/debug.c Tue Feb 5 12:08:16 2002
@@ -110,7 +110,7 @@
/*** Private Function Prototype Declarations ****/
/*** Private Variable Declarations ***/
-static FILE *__rsd_debug_file = stdout;
+static FILE *__rsd_debug_file;
/*****
* When debug output is send to a file, we register an exit func to close
@@ -128,7 +128,11 @@
#endif
{
/* close output file */
- fclose(__rsd_debug_file);
+ if (__rsd_debug_file) {
+ fclose(__rsd_debug_file);
+ __rsd_debug_file = NULL;
+ }
+
}
/*****
@@ -146,6 +150,7 @@
#ifdef __STDC__
__rsd_fprintf(char *fmt, ...)
{
+ register FILE *fp = (__rsd_debug_file ? __rsd_debug_file : stdout);
va_list arg_list;
va_start(arg_list, fmt);
@@ -155,15 +160,16 @@
char *fmt;
va_dcl
{
+ register FILE *fp = (__rsd_debug_file ? __rsd_debug_file : stdout);
va_list arg_list;
va_start(arg_list);
#endif /* __STDC__ */
/* flush to file */
- vfprintf(__rsd_debug_file, fmt, arg_list);
+ vfprintf(fp, fmt, arg_list);
va_end(arg_list);
- fflush(__rsd_debug_file);
+ fflush(fp);
}
/*****
@@ -298,8 +304,10 @@
if((chPtr = strstr(argv[i], ":")) != NULL)
{
/* close any existing output file */
- if(__rsd_debug_file != stdout)
+ if(__rsd_debug_file) {
fclose(__rsd_debug_file);
+ __rsd_debug_file = NULL;
+ }
chPtr++; /* skip : */
if(!strcmp(chPtr, "pid")) /* <pid>.out */
@@ -336,14 +344,14 @@
fprintf(stderr, "__rsd_setDebugLevels: failed to open "
"output file %s (errno = %i), reverting to "
"stdout\n", tmp, errno);
- __rsd_debug_file = stdout;
+ __rsd_debug_file = NULL;
}
}
else
{
fprintf(stderr, "__rsd_setDebugLevels: missing arg to "
"-dfile:, reverting to stdout\n");
- __rsd_debug_file = stdout;
+ __rsd_debug_file = NULL;
}
/* remove from cmd line */
REMOVE_ARG;