155988Sbostic /*- 261262Sbostic * Copyright (c) 1992, 1993 361262Sbostic * The Regents of the University of California. All rights reserved. 455988Sbostic * 555988Sbostic * %sccs.include.redist.c% 655988Sbostic */ 755988Sbostic 855988Sbostic #ifndef lint 9*64698Sbostic static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/05/93"; 1055988Sbostic #endif /* not lint */ 1155988Sbostic 1255988Sbostic #ifdef DEBUG 1355988Sbostic #include <stdio.h> 1455988Sbostic 15*64698Sbostic #ifdef __STDC__ 1655988Sbostic #include <stdarg.h> 1755988Sbostic #else 1855988Sbostic #include <varargs.h> 1955988Sbostic #endif 2055988Sbostic 2155988Sbostic #ifndef TFILE 2255988Sbostic #define TFILE "__curses.out" 2355988Sbostic #endif 2455988Sbostic 2555988Sbostic static FILE *tracefp; /* Curses debugging file descriptor. */ 2655988Sbostic 2755988Sbostic void 28*64698Sbostic #ifdef __STDC__ __CTRACE(const char * fmt,...)2960058Sbostic__CTRACE(const char *fmt, ...) 3055988Sbostic #else 3160058Sbostic __CTRACE(fmt, va_alist) 3255988Sbostic char *fmt; 3355988Sbostic va_dcl 3455988Sbostic #endif 3555988Sbostic { 3655988Sbostic va_list ap; 37*64698Sbostic #ifdef __STDC__ 3855988Sbostic va_start(ap, fmt); 3955988Sbostic #else 4055988Sbostic va_start(ap); 4155988Sbostic #endif 4255988Sbostic if (tracefp == NULL) 4355988Sbostic tracefp = fopen(TFILE, "w"); 4455988Sbostic if (tracefp == NULL) 4555988Sbostic return; 4655988Sbostic (void)vfprintf(tracefp, fmt, ap); 4755988Sbostic va_end(ap); 4855988Sbostic (void)fflush(tracefp); 4955988Sbostic } 5055988Sbostic #endif 51