#ifndef lint
static char copyright[] =
-"$Id: confpars.c,v 1.53 1998/11/06 00:31:08 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: confpars.c,v 1.54 1998/11/06 02:58:17 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
lose = 0;
et = parse_executable_statement (cfile, &lose);
if (!et) {
- if (declaration && !lose)
- parse_warn ("expecting a %s.",
- "declaration");
- else if (!lose)
- parse_warn ("expecting a parameter%s.",
- " or declaration");
- skip_to_semi (cfile);
+ if (!lose) {
+ if (declaration)
+ parse_warn ("expecting a %s.",
+ "declaration");
+ else
+ parse_warn ("expecting a%s%s.",
+ " parameter",
+ " or declaration");
+ skip_to_semi (cfile);
+ }
return declaration;
}
}
{
char *val;
enum dhcp_token token;
- struct class *class, *pc;
+ struct class *class = (struct class *)0, *pc;
int declaration = 0;
int lose;
struct data_string data;
char *name;
struct executable_statement *stmt = (struct executable_statement *)0;
struct expression *expr;
+ int new = 1;
token = next_token (&val, cfile);
if (token != STRING) {
/* If this isn't a subclass, we're updating an existing class. */
if (pc && type != 0 && type != 1 && type != 3) {
class = pc;
+ new = 0;
pc = (struct class *)0;
}
memset (&data, 0, sizeof data);
if (!parse_cshl (&data, cfile))
return;
- data.terminated = 0;
- data.buffer = 0;
}
}
}
class -> statements = stmt;
}
+
+ /* Save the name, if there is one. */
+ class -> name = name;
}
if (!parse_lbrace (cfile))
#if defined (DEBUG_EXPRESSION_PARSE)
print_expression ("class match", class -> expr);
#endif
+ parse_semi (cfile);
} else if (token == SPAWN) {
if (pc) {
parse_warn ("invalid spawn in subclass.");
#if defined (DEBUG_EXPRESSION_PARSE)
print_expression ("class match", class -> spawn);
#endif
+ parse_semi (cfile);
} else {
declaration = parse_statement (cfile, class -> group,
CLASS_DECL,
declaration);
}
} while (1);
+ if (type == 2 && new) {
+ if (!collections -> classes)
+ collections -> classes = class;
+ else {
+ struct class *cp;
+ for (cp = collections -> classes;
+ cp -> nic; cp = cp -> nic)
+ ;
+ cp -> nic = class;
+ }
+ }
}
/* shared-network-declaration :==