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

Diff of /imapfilter/log.c

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

revision 1.4 by lefcha, Sun Aug 12 16:58:21 2001 UTC revision 1.5 by lefcha, Thu Aug 23 19:13:15 2001 UTC
# Line 11  Line 11 
11    
12    
13  extern int options;  extern int options;
14  extern account_data account;  extern char logfile[PATH_MAX];
15  static FILE *logfp;             /* Points to logfile. */  static FILE *logfp;             /* Points to logfile. */
16    
17    
# Line 38  void error(const char *errmsg, ...) Line 38  void error(const char *errmsg, ...)
38    
39      va_start(args, errmsg);      va_start(args, errmsg);
40    
41      if (account.logfile[0]) {      if (logfile[0]) {
42          vfprintf(logfp, errmsg, args);          vfprintf(logfp, errmsg, args);
43      }      }
44    
# Line 52  void error(const char *errmsg, ...) Line 52  void error(const char *errmsg, ...)
52   */   */
53  int open_logfile(void)  int open_logfile(void)
54  {  {
55      if (!(account.logfile[0]))      if (!(logfile[0]))
56          return SUCCESS;         /* Logging not enabled. */          return SUCCESS;         /* Logging not enabled. */
57    
58  #ifdef DEBUG  #ifdef DEBUG
59      printf("debug: logfile: %s\n", account.logfile);      printf("debug: logfile: %s\n", logfile);
60  #endif  #endif
61    
62      logfp = fopen(account.logfile, "a");      logfp = fopen(logfile, "a");
63    
64      if (!logfp) {      if (!logfp) {
65          fprintf(stderr, "imapfilter: opening logfile %s: %s\n",          fprintf(stderr, "imapfilter: opening logfile %s: %s\n",
66                  account.logfile, strerror(errno));                  logfile, strerror(errno));
67          return FAILURE;          return FAILURE;
68      }      }
69    
# Line 76  int open_logfile(void) Line 76  int open_logfile(void)
76   */   */
77  int close_logfile(void)  int close_logfile(void)
78  {  {
79      if (!(account.logfile[0]))      if (!(logfile[0]))
80          return SUCCESS;          return SUCCESS;
81      else      else
82          return fclose(logfp);          return fclose(logfp);
# Line 90  void log_info(const char *info, ...) Line 90  void log_info(const char *info, ...)
90  {  {
91      va_list args;      va_list args;
92    
93      if (account.logfile[0]) {      if (logfile[0]) {
94          va_start(args, info);          va_start(args, info);
95          vfprintf(logfp, info, args);          vfprintf(logfp, info, args);
96          va_end(args);          va_end(args);

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26