Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (1.53 KB)

1
/*
2
 *	BIRD -- UNIX Configuration
3
 *
4
 *	(c) 1999--2000 Martin Mares <mj@ucw.cz>
5
 *
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
CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG, STDERR)
16

    
17
%type <i> log_mask log_mask_list log_cat
18
%type <g> log_file
19
%type <t> cfg_name
20

    
21
CF_GRAMMAR
22

    
23
CF_ADDTO(conf, log_config)
24

    
25
log_config: LOG log_file log_mask ';' {
26
    struct log_config *c = cfg_allocz(sizeof(struct log_config));
27
    c->fh = $2;
28
    c->mask = $3;
29
    add_tail(&new_config->logfiles, &c->n);
30
  }
31
 ;
32

    
33
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
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
/* Unix specific commands */
66

    
67
CF_CLI(CONFIGURE, cfg_name, [<file>], [[Reload configuration]])
68
{ cmd_reconfig($2); } ;
69

    
70
CF_CLI(SHUTDOWN,,, [[Shut the daemon down]])
71
{ cli_msg(7, "Shutdown requested"); order_shutdown(); } ;
72

    
73
cfg_name:
74
   /* empty */ { $$ = NULL; }
75
 | TEXT
76
 ;
77

    
78
CF_CODE
79

    
80
CF_END