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 |
|
|
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 |
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); |
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); |