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

Diff of /imapfilter/log.c

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

revision 1.2 by lefcha, Sat Aug 11 15:54:57 2001 UTC revision 1.3 by lefcha, Sun Aug 12 16:06:45 2001 UTC
# 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 (!(options & OPTION_LOGGING_DISABLED)) {      if (account.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      char *home;      if (!(account.logfile[0]))
56            return SUCCESS;         /* Logging not enabled. */
57      if (options & OPTION_LOGGING_DISABLED)      
         return SUCCESS;  
   
     if (!account.logfile[0]) {  
         home = getenv("HOME");  
   
         snprintf(account.logfile, PATH_MAX, "%s/%s", home,  
                  ".imapfilter_log");  
     }  
58  #ifdef DEBUG  #ifdef DEBUG
59      printf("debug: logfile: %s\n", account.logfile);      printf("debug: logfile: %s\n", account.logfile);
60  #endif  #endif
# Line 84  int open_logfile(void) Line 76  int open_logfile(void)
76   */   */
77  int close_logfile(void)  int close_logfile(void)
78  {  {
79      if (options & OPTION_LOGGING_DISABLED)      if (!(account.logfile[0]))
80          return SUCCESS;          return SUCCESS;
81      else      else
82          return fclose(logfp);          return fclose(logfp);
# Line 98  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 (!(options & OPTION_LOGGING_DISABLED)) {      if (account.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.2  
changed lines
  Added in v.1.3

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26