From: Ted Lemon Date: Thu, 25 Mar 1999 21:45:55 +0000 (+0000) Subject: Support option code definition. X-Git-Tag: V3-ALPHA-19990326~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=770e11521fe0d7247659af75038b106115497f60;p=thirdparty%2Fdhcp.git Support option code definition. --- diff --git a/client/clparse.c b/client/clparse.c index 0e82370a6..908fb4773 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -22,7 +22,7 @@ #ifndef lint static char copyright[] = -"$Id: clparse.c,v 1.28 1999/03/16 06:37:47 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; +"$Id: clparse.c,v 1.29 1999/03/25 21:45:55 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -281,7 +281,7 @@ void parse_client_statement (cfile, ip, config) op = supersede_option_statement; do_option: token = next_token (&val, cfile); - option = parse_option_name (cfile); + option = parse_option_name (cfile, 0); if (!option) return; stmt = parse_option_statement (cfile, 1, option, op); @@ -291,6 +291,29 @@ void parse_client_statement (cfile, ip, config) stmt -> next = (struct executable_statement *)0; return; + case OPTION: + token = next_token (&val, cfile); + option = parse_option_name (cfile, 1); + if (!option) + return; + + token = next_token (&val, cfile); + if (token != CODE) { + parse_warn ("expecting \"code\" keyword."); + skip_to_semi (cfile); + return; + } + if (ip) { + parse_warn ("option definitions may only appear in %s", + "the outermost scope."); + skip_to_semi (cfile); + free_option (option, "parse_statement"); + return; + } + if (!parse_option_code_definition (cfile, option)) + free_option (option, "parse_statement"); + return; + case DEFAULT: p = &config -> on_receipt -> statements; op = default_option_statement; @@ -918,7 +941,7 @@ int parse_option_decl (oc, cfile) int nul_term = 0; struct buffer *bp; - option = parse_option_name (cfile); + option = parse_option_name (cfile, 0); if (!option) return 0;