home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3594 / xcdbglog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-11  |  782 b   |  45 lines

  1. /*    xcdbglog.c -- debug logging module for XC
  2.     This file uses 4-character tabstops
  3. */
  4.  
  5. #ifdef DEBUG
  6. #undef DEBUG
  7. #include <stdio.h>
  8. #include <time.h>
  9. #include <sys/types.h>
  10. #include "xc.h"
  11.  
  12. extern short captflag;
  13. static FILE *dfp;
  14.  
  15. void dbglog()
  16. {
  17.     long todnow;
  18.  
  19.     time(&todnow);
  20.     if (!access("debug.log",0) && (dfp=fopen("debug.log","w"))!=NULLF)
  21.         fprintf(dfp,(char*)asctime(localtime(&todnow)));
  22.     return;
  23. }
  24.  
  25. Fputc(c,stream)
  26. register c;
  27. FILE *stream;
  28. {
  29.     if (!capture && !captflag && dfp && c != '\r')
  30.         fputc(c,dfp);
  31.     return(fputc(c,stream));
  32. }
  33.  
  34. Fprintf(stream,control,a,b,c,d,e,f,g)
  35. FILE *stream;
  36. char *control;
  37. long a,b,c,d,e,f,g;
  38. {
  39.     if (!capture && !captflag && dfp)
  40.         fprintf(dfp,control,a,b,c,d,e,f,g),
  41.         fflush(dfp);
  42.     fprintf(stream,control,a,b,c,d,e,f,g);
  43. }
  44. #endif /*DEBUG*/
  45.