summaryrefslogtreecommitdiffstats
path: root/sysdep/unix/config.Y
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-12-06 14:51:04 +0100
committerMartin Mares <mj@ucw.cz>1999-12-06 14:51:04 +0100
commitf78056fb2cf4554d5dcc50b5e0e79bc09ae825cf (patch)
tree0733bbab60ef3fd23c5481fccfebf1814e8ad98b /sysdep/unix/config.Y
parent4ab5331c6370ba83dc7b228f9a94ccc1c64a973e (diff)
downloadbird-f78056fb2cf4554d5dcc50b5e0e79bc09ae825cf.tar
bird-f78056fb2cf4554d5dcc50b5e0e79bc09ae825cf.zip
Allow logging to stderr as well.
Diffstat (limited to 'sysdep/unix/config.Y')
-rw-r--r--sysdep/unix/config.Y24
1 files changed, 14 insertions, 10 deletions
diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y
index bd9c382..f0a517e 100644
--- a/sysdep/unix/config.Y
+++ b/sysdep/unix/config.Y
@@ -12,29 +12,33 @@ CF_HDR
CF_DECLS
-CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG)
+CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG, STDERR)
%type <i> log_mask log_mask_list log_cat
+%type <g> log_file
CF_GRAMMAR
CF_ADDTO(conf, log_config)
-log_config: LOG TEXT log_mask ';' {
- struct log_config *c = cfg_allocz(sizeof(struct log_config));
- FILE *f = rfopen(new_config->pool, $2, "a");
- if (!f) cf_error("Unable to open log file `%s': %m", $2);
- c->mask = $3;
- c->fh = f;
- add_tail(&new_config->logfiles, &c->n);
- }
- | LOG SYSLOG log_mask ';' {
+log_config: LOG log_file log_mask ';' {
struct log_config *c = cfg_allocz(sizeof(struct log_config));
+ c->fh = $2;
c->mask = $3;
add_tail(&new_config->logfiles, &c->n);
}
;
+log_file:
+ TEXT {
+ FILE *f = tracked_fopen(new_config->pool, $1, "a");
+ if (!f) cf_error("Unable to open log file `%s': %m", $1);
+ $$ = f;
+ }
+ | SYSLOG { $$ = NULL; }
+ | STDERR { $$ = stderr; }
+ ;
+
log_mask:
ALL { $$ = ~0; }
| '{' log_mask_list '}' { $$ = $2; }