1 /*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/05/93"; 10 #endif /* not lint */ 11 12 #ifdef DEBUG 13 #include <stdio.h> 14 15 #ifdef __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 #ifdef __STDC__ 29 __CTRACE(const char *fmt, ...) 30 #else 31 __CTRACE(fmt, va_alist) 32 char *fmt; 33 va_dcl 34 #endif 35 { 36 va_list ap; 37 #ifdef __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