static struct keyword *kw_hash[KW_HASH_SIZE];
static struct symbol **sym_hash;
static int allow_new_symbols;
-static int default_counter;
int conf_lino;
int l;
while (s)
- if (!strcmp(s->name, c))
- return s;
+ {
+ if (!strcmp(s->name, c))
+ return s;
+ s = s->next;
+ }
if (!allow_new_symbols)
return NULL;
l = strlen(c);
}
struct symbol *
-cf_default_name(char *prefix)
+cf_default_name(char *prefix, int *counter)
{
char buf[32];
struct symbol *s;
do
{
- sprintf(buf, "%s%d", prefix, default_counter++);
+ sprintf(buf, "%s%d", prefix, ++(*counter));
s = cf_find_sym(buf, cf_hash(buf));
if (!s) cf_error("Unable to generate default name");
}
if (allow_new_symbols = flag)
sym_hash = cfg_allocz(SYM_HASH_SIZE * sizeof(struct keyword *));
conf_lino = 1;
- default_counter = 1;
}
void
void cf_lex_init_tables(void);
int cf_lex(void);
void cf_lex_init(int flag);
-struct symbol *cf_default_name(char *prefix);
+struct symbol *cf_default_name(char *prefix, int *counter);
/* Parser */
char *name;
unsigned debug; /* Default debugging flags */
int priority; /* Protocol priority (usually 0) */
+ int name_counter; /* Counter for automatic name generation */
void (*preconfig)(struct protocol *, struct config *); /* Just before configuring */
void (*postconfig)(struct proto_config *); /* After configuring each instance */