Statistics
| Branch: | Revision:

iof-bird-daemon / sysdep / unix / config.Y @ f7fcb752

History | View | Annotate | Download (1.53 KB)

1 a0c37b45 Martin Mares
/*
2
 *	BIRD -- UNIX Configuration
3
 *
4 50fe90ed Martin Mares
 *	(c) 1999--2000 Martin Mares <mj@ucw.cz>
5 a0c37b45 Martin Mares
 *
6
 *	Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8
9
CF_HDR
10
11
#include "lib/unix.h"
12
13
CF_DECLS
14
15 f78056fb Martin Mares
CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG, STDERR)
16 a0c37b45 Martin Mares
17
%type <i> log_mask log_mask_list log_cat
18 f78056fb Martin Mares
%type <g> log_file
19 50fe90ed Martin Mares
%type <t> cfg_name
20 a0c37b45 Martin Mares
21
CF_GRAMMAR
22
23
CF_ADDTO(conf, log_config)
24
25 f78056fb Martin Mares
log_config: LOG log_file log_mask ';' {
26 a0c37b45 Martin Mares
    struct log_config *c = cfg_allocz(sizeof(struct log_config));
27 f78056fb Martin Mares
    c->fh = $2;
28 a0c37b45 Martin Mares
    c->mask = $3;
29
    add_tail(&new_config->logfiles, &c->n);
30
  }
31
 ;
32
33 f78056fb Martin Mares
log_file:
34
   TEXT {
35
     FILE *f = tracked_fopen(new_config->pool, $1, "a");
36
     if (!f) cf_error("Unable to open log file `%s': %m", $1);
37
     $$ = f;
38
   }
39
 | SYSLOG { $$ = NULL; }
40
 | STDERR { $$ = stderr; }
41
 ;
42
43 a0c37b45 Martin Mares
log_mask:
44
   ALL { $$ = ~0; }
45
 | '{' log_mask_list '}' { $$ = $2; }
46
 ;
47
48
log_mask_list:
49
   log_cat { $$ = 1 << $1; }
50
 | log_mask_list ',' log_cat { $$ = $1 | (1 << $3); }
51
 ;
52
53
log_cat:
54
   DEBUG { $$ = L_DEBUG[0]; }
55
 | TRACE { $$ = L_TRACE[0]; }
56
 | INFO { $$ = L_INFO[0]; }
57
 | REMOTE { $$ = L_REMOTE[0]; }
58
 | WARNING { $$ = L_WARN[0]; }
59
 | ERROR { $$ = L_ERR[0]; }
60
 | AUTH { $$ = L_AUTH[0]; }
61
 | FATAL { $$ = L_FATAL[0]; }
62
 | BUG { $$ = L_BUG[0]; }
63
 ;
64
65 50fe90ed Martin Mares
/* Unix specific commands */
66
67
CF_CLI(CONFIGURE, cfg_name, [<file>], [[Reload configuration]])
68
{ cmd_reconfig($2); } ;
69
70 bf8558bc Martin Mares
CF_CLI(SHUTDOWN,,, [[Shut the daemon down]])
71 99278e10 Martin Mares
{ cli_msg(7, "Shutdown requested"); order_shutdown(); } ;
72 bf8558bc Martin Mares
73 50fe90ed Martin Mares
cfg_name:
74
   /* empty */ { $$ = NULL; }
75
 | TEXT
76
 ;
77
78 a0c37b45 Martin Mares
CF_CODE
79
80
CF_END