1 /*- 2 * Copyright (c) 1992 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)ctrace.c 5.3 (Berkeley) 10/01/92"; 10 #endif /* not lint */ 11 12 #define DEBUG 13 #ifdef DEBUG 14 #include <stdio.h> 15 16 #if __STDC__ 17 #include <stdarg.h> 18 #else 19 #include <varargs.h> 20 #endif 21 22 #ifndef TFILE 23 #define TFILE "__curses.out" 24 #endif 25 26 static FILE *tracefp; /* Curses debugging file descriptor. */ 27 28 void 29 #if __STDC__ 30 __TRACE(const char *fmt, ...) 31 #else 32 __TRACE(fmt, va_alist) 33 char *fmt; 34 va_dcl 35 #endif 36 { 37 va_list ap; 38 #if __STDC__ 39 va_start(ap, fmt); 40 #else 41 va_start(ap); 42 #endif 43 if (tracefp == NULL) 44 tracefp = fopen(TFILE, "w"); 45 if (tracefp == NULL) 46 return; 47 (void)vfprintf(tracefp, fmt, ap); 48 va_end(ap); 49 (void)fflush(tracefp); 50 } 51 #endif 52