File: debug.c

package info (click to toggle)
libcdk 4.9.9-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,008 kB
  • ctags: 2,239
  • sloc: ansic: 28,664; sh: 334; makefile: 275; cpp: 42
file content (50 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "cdk.h"

/*
 * $Author: glover $
 * $Date: 1997/04/06 22:59:36 $
 * $Revision: 1.7 $
 */

FILE	*CDKDEBUG;


/*
 * This starts debugging for CDK.
 */
FILE *startCDKDebug (char *filename)
{
   char *defFile = "cdkdebug.log";

   /* Check if the filename is NULL. */
   if (filename == (char *)NULL)
   {
      filename = defFile;
   }

   /* Try to open the file. */
   return ( fopen (filename, "w") );
}

/*
 * This writes a message to the debug file.
 */
void writeCDKDebugMessage (FILE *fd, char *filename, char *function, int line, char *message)
{
   /* Print the message as long as the file descr. is not NULL.	*/
   if (fd != NULL)
   {
      fprintf (fd, "%s::%s (Line %d) %s\n", filename, function, line, message);
   }
}

/*
 * This turns off the debugging for CDK.
 */
void stopCDKDebug (FILE *fd)
{
   if (fd != NULL)
   {
      fclose (fd);
   }
}