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.4 (Berkeley) 11/10/92"; 10 #endif /* not lint */ 11 12 #ifdef DEBUG 13 #include <stdio.h> 14 15 #if __STDC__ 16 #include <stdarg.h> 17 #else 18 #include <varargs.h> 19 #endif 20 21 #ifndef TFILE 22 #define TFILE "__curses.out" 23 #endif 24 25 static FILE *tracefp; /* Curses debugging file descriptor. */ 26 27 void 28 #if __STDC__ 29 __TRACE(const char *fmt, ...) 30 #else 31 __TRACE(fmt, va_alist) 32 char *fmt; 33 va_dcl 34 #endif 35 { 36 va_list ap; 37 #if __STDC__ 38 va_start(ap, fmt); 39 #else 40 va_start(ap); 41 #endif 42 if (tracefp == NULL) 43 tracefp = fopen(TFILE, "w"); 44 if (tracefp == NULL) 45 return; 46 (void)vfprintf(tracefp, fmt, ap); 47 va_end(ap); 48 (void)fflush(tracefp); 49 } 50 #endif 51