File: debug.c

package info (click to toggle)
libcdk5 5.0.20161210-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,440 kB
  • ctags: 2,833
  • sloc: ansic: 32,375; sh: 4,732; makefile: 1,122; sed: 43; cpp: 41
file content (53 lines) | stat: -rw-r--r-- 903 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
51
52
53
#include <cdk_int.h>

/*
 * $Author: tom $
 * $Date: 2012/03/20 21:58:33 $
 * $Revision: 1.11 $
 */

FILE *CDKDEBUG;


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

   /* Check if the filename is null. */
   if (filename == 0)
   {
      filename = defFile;
   }

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

/*
 * This writes a message to the debug file.
 */
void writeCDKDebugMessage (FILE * fd,
			   const char *filename,
			   const char *function,
			   int line, const char *message)
{
   /* Print the message as long as the file pointer is not null. */
   if (fd != 0)
   {
      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 != 0)
   {
      fclose (fd);
   }
}