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