Revision 31b3e1bb conf/cf-lex.l

View differences:

conf/cf-lex.l
1 1
/*
2 2
 *	BIRD -- Configuration Lexer
3 3
 *
4
 *	(c) 1998 Martin Mares <mj@ucw.cz>
4
 *	(c) 1998--1999 Martin Mares <mj@ucw.cz>
5 5
 *
6 6
 *	Can be freely distributed and used under the terms of the GNU GPL.
7 7
 */
......
15 15
#include <stdarg.h>
16 16

  
17 17
#include "nest/bird.h"
18
#include "lib/string.h"
19 18
#include "conf/conf.h"
20 19
#include "conf/cf-parse.tab.h"
21 20

  
......
34 33
static struct keyword *kw_hash[KW_HASH_SIZE];
35 34
static struct symbol **sym_hash;
36 35
static int allow_new_symbols;
37
static int cf_lino;
38 36
static int default_counter;
39 37

  
38
int conf_lino;
39

  
40 40
static int cf_hash(byte *c);
41 41
static struct symbol *cf_find_sym(byte *c, unsigned int h0);
42 42

  
......
121 121
{WHITE}+
122 122

  
123 123
\\\n {
124
  cf_lino++;
124
  conf_lino++;
125 125
}
126 126

  
127 127
\n {
128
  cf_lino++;
128
  conf_lino++;
129 129
  return ';';
130 130
}
131 131

  
......
136 136
.	cf_error("Unknown character");
137 137

  
138 138
<COMMENT>\n {
139
  cf_lino++;
139
  conf_lino++;
140 140
  BEGIN(INITIAL);
141 141
}
142 142

  
143 143
<COMMENT>.
144 144

  
145 145
<CCOMM>\*\/	BEGIN(INITIAL);
146
<CCOMM>\n	cf_lino++;
146
<CCOMM>\n	conf_lino++;
147 147
<CCOMM>\/\*	cf_error("Comment nesting not supported");
148 148
<CCOMM><<EOF>>	cf_error("Unterminated comment");
149 149
<CCOMM>.
......
206 206
{
207 207
  if (allow_new_symbols = flag)
208 208
    sym_hash = cfg_allocz(SYM_HASH_SIZE * sizeof(struct keyword *));
209
  cf_lino = 1;
209
  conf_lino = 1;
210 210
  default_counter = 1;
211 211
}
212 212

  
......
222 222
      kw_hash[h] = k;
223 223
    }
224 224
}
225

  
226
void
227
cf_error(char *msg, ...)
228
{
229
  /* FIXME */
230

  
231
  char buf[1024];
232
  va_list args;
233

  
234
  va_start(args, msg);
235
  bvsprintf(buf, msg, args);
236
  die(PATH_CONFIG ", line %d: %s", cf_lino, buf);
237
}
238

  
239
void
240
cf_allocate(void)
241
{
242
  if (cfg_pool)
243
    rfree(cfg_pool);
244
  cfg_pool = rp_new(&root_pool, "Config");
245
  cfg_mem = lp_new(cfg_pool, 1024);
246
}
247

  
248
char *
249
cfg_strdup(char *c)
250
{
251
  int l = strlen(c) + 1;
252
  char *z = cfg_allocu(l);
253
  memcpy(z, c, l);
254
  return z;
255
}

Also available in: Unified diff