/[imapfilter]/imapfilter/log.c
ViewVC logotype

Diff of /imapfilter/log.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by lefcha, Sun Aug 26 10:02:46 2001 UTC revision 1.8 by lefcha, Sun Aug 26 20:02:53 2001 UTC
# Line 10  Line 10 
10  #include "log.h"  #include "log.h"
11    
12    
 extern int options;  
13  extern char logfile[PATH_MAX];  extern char logfile[PATH_MAX];
14    extern unsigned int options;
15    
16  static FILE *logfp;             /* Points to logfile. */  static FILE *logfp = NULL;      /* Points to logfile. */
17    
18    
19  /*  /*
# Line 22  static FILE *logfp;            /* Points to logfil Line 22  static FILE *logfp;            /* Points to logfil
22  void info(const char *info, ...)  void info(const char *info, ...)
23  {  {
24      va_list args;      va_list args;
25        
26      if (!(options & OPT_DETAILS_QUITE)) {      if (!(options & OPT_DETAILS_QUITE)) {
27          va_start(args, info);          va_start(args, info);
28          vprintf(info, args);          vprintf(info, args);
# Line 54  void error(const char *errmsg, ...) Line 54  void error(const char *errmsg, ...)
54    
55      va_start(args, errmsg);      va_start(args, errmsg);
56    
57      if (logfile[0]) {      if (logfp) {
58          vfprintf(logfp, errmsg, args);          vfprintf(logfp, errmsg, args);
59      }      }
60    
# Line 72  int open_logfile(void) Line 72  int open_logfile(void)
72          return 0;               /* Logging not enabled. */          return 0;               /* Logging not enabled. */
73    
74  #ifdef DEBUG  #ifdef DEBUG
75      printf("debug: logfile: %s\n", logfile);      printf("debug: logfile: '%s'\n", logfile);
76  #endif  #endif
77    
78      logfp = fopen(logfile, "a");      logfp = fopen(logfile, "a");
# Line 92  int open_logfile(void) Line 92  int open_logfile(void)
92   */   */
93  int close_logfile(void)  int close_logfile(void)
94  {  {
95      if (!(logfile[0]))      if (!logfp)
96          return 0;          return 0;
97      else      else
98          return fclose(logfp);          return fclose(logfp);
# Line 106  void log_info(const char *info, ...) Line 106  void log_info(const char *info, ...)
106  {  {
107      va_list args;      va_list args;
108    
109      if (logfile[0]) {      if (logfp) {
110          va_start(args, info);          va_start(args, info);
111          vfprintf(logfp, info, args);          vfprintf(logfp, info, args);
112          va_end(args);          va_end(args);

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26