From: Ted Lemon Date: Thu, 1 Mar 2001 18:17:09 +0000 (+0000) Subject: Change EOF to END_OF_FILE in tokenizer for enum compatibility. X-Git-Tag: V3-BETA-2-PATCH-19~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b69dcc8709461c9fd2bfa644d0d78b827d06ef3;p=thirdparty%2Fdhcp.git Change EOF to END_OF_FILE in tokenizer for enum compatibility. --- diff --git a/client/clparse.c b/client/clparse.c index 8f54209cc..0cde199e2 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -3,7 +3,7 @@ Parser for dhclient config and lease files... */ /* - * Copyright (c) 1996-2000 Internet Software Consortium. + * Copyright (c) 1996-2001 Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: clparse.c,v 1.56 2001/02/26 22:21:02 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: clparse.c,v 1.57 2001/03/01 18:16:57 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -65,7 +65,7 @@ u_int32_t default_requested_options [] = { 0 }; -/* client-conf-file :== client-declarations EOF +/* client-conf-file :== client-declarations END_OF_FILE client-declarations :== | client-declaration | client-declarations client-declaration */ @@ -114,7 +114,7 @@ isc_result_t read_client_conf () do { token = peek_token (&val, cfile); - if (token == EOF) + if (token == END_OF_FILE) break; parse_client_statement (cfile, (struct interface_info *)0, @@ -157,7 +157,7 @@ isc_result_t read_client_conf () return status; } -/* lease-file :== client-lease-statements EOF +/* lease-file :== client-lease-statements END_OF_FILE client-lease-statements :== | client-lease-statements LEASE client-lease-statement */ @@ -177,7 +177,7 @@ void read_client_leases () do { token = next_token (&val, cfile); - if (token == EOF) + if (token == END_OF_FILE) break; if (token != LEASE) { log_error ("Corrupt lease file - possible data loss!"); @@ -666,7 +666,7 @@ void parse_interface_declaration (cfile, outer_config, name) do { token = peek_token (&val, cfile); - if (token == EOF) { + if (token == END_OF_FILE) { parse_warn (cfile, "unterminated interface declaration."); return; @@ -788,7 +788,7 @@ void parse_client_lease_statement (cfile, is_static) do { token = peek_token (&val, cfile); - if (token == EOF) { + if (token == END_OF_FILE) { parse_warn (cfile, "unterminated lease declaration."); return; } diff --git a/common/conflex.c b/common/conflex.c index ba22e32b3..51b06c102 100644 --- a/common/conflex.c +++ b/common/conflex.c @@ -3,7 +3,7 @@ Lexical scanner for dhcpd config file... */ /* - * Copyright (c) 1995-2000 Internet Software Consortium. + * Copyright (c) 1995-2001 Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: conflex.c,v 1.88 2001/02/27 01:15:36 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: conflex.c,v 1.89 2001/03/01 18:16:59 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -208,6 +208,9 @@ static enum dhcp_token get_token (cfile) cfile -> lexchar = p; ttok = read_num_or_name (c, cfile); break; + } else if (c == EOF) { + ttok = END_OF_FILE; + break; } else { cfile -> lexline = l; cfile -> lexchar = p; diff --git a/common/parse.c b/common/parse.c index dbe263a7d..b3909e9c6 100644 --- a/common/parse.c +++ b/common/parse.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: parse.c,v 1.100 2001/02/12 19:44:54 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n"; +"$Id: parse.c,v 1.101 2001/03/01 18:17:00 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -139,7 +139,7 @@ void skip_to_rbrace (cfile, brace_count) return; } token = next_token (&val, cfile); - } while (token != EOF); + } while (token != END_OF_FILE); } int parse_semi (cfile) @@ -461,7 +461,7 @@ unsigned char *parse_numeric_aggregate (cfile, buf, } token = next_token (&val, cfile); - if (token == EOF) { + if (token == END_OF_FILE) { parse_warn (cfile, "unexpected end of file"); break; } @@ -2333,7 +2333,7 @@ int parse_on_statement (result, cfile, lose) /* Try to even things up. */ do { token = next_token (&val, cfile); - } while (token != EOF && token != RBRACE); + } while (token != END_OF_FILE && token != RBRACE); executable_statement_dereference (result, MDL); return 0; } @@ -2525,7 +2525,7 @@ int parse_if_statement (result, cfile, lose) /* Try to even things up. */ do { token = next_token (&val, cfile); - } while (token != EOF && token != RBRACE); + } while (token != END_OF_FILE && token != RBRACE); executable_statement_dereference (result, MDL); return 0; } diff --git a/common/resolv.c b/common/resolv.c index 4c302bb26..051a672b1 100644 --- a/common/resolv.c +++ b/common/resolv.c @@ -3,7 +3,7 @@ Parser for /etc/resolv.conf file. */ /* - * Copyright (c) 1996-2000 Internet Software Consortium. + * Copyright (c) 1996-2001 Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: resolv.c,v 1.13 2000/03/17 03:59:02 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: resolv.c,v 1.14 2001/03/01 18:17:02 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -75,7 +75,7 @@ void read_resolv_conf (parse_time) do { token = next_token (&val, cfile); - if (token == EOF) + if (token == END_OF_FILE) break; else if (token == EOL) continue; diff --git a/dhcpctl/omshell.c b/dhcpctl/omshell.c index 4fb47d4f9..24a85cb8d 100644 --- a/dhcpctl/omshell.c +++ b/dhcpctl/omshell.c @@ -1,4 +1,4 @@ -/* omapictl.c +/* omshell.c Examine and modify omapi objects. */ @@ -224,7 +224,7 @@ int main (int argc, char **argv, char **envp) parse_warn (cfile, "unknown token: %s", val); break; - case EOF: + case END_OF_FILE: break; case TOKEN_HELP: @@ -239,7 +239,7 @@ int main (int argc, char **argv, char **envp) case TOKEN_NEW: token = next_token (&val, cfile); if ((!is_identifier (token) && token != STRING) || - next_token (NULL, cfile) != EOF) + next_token (NULL, cfile) != END_OF_FILE) { printf ("usage: new \n"); break; @@ -260,7 +260,7 @@ int main (int argc, char **argv, char **envp) break; case TOKEN_CLOSE: - if (next_token (NULL, cfile) != EOF) { + if (next_token (NULL, cfile) != END_OF_FILE) { printf ("usage: close\n"); } @@ -304,7 +304,7 @@ int main (int argc, char **argv, char **envp) case TOKEN_CREATE: case TOKEN_OPEN: - if (next_token (NULL, cfile) != EOF) { + if (next_token (NULL, cfile) != END_OF_FILE) { printf ("usage: %s\n", val); } @@ -327,7 +327,7 @@ int main (int argc, char **argv, char **envp) break; case UPDATE: - if (next_token (NULL, cfile) != EOF) { + if (next_token (NULL, cfile) != END_OF_FILE) { printf ("usage: %s\n", val); } diff --git a/includes/dhctoken.h b/includes/dhctoken.h index cd94c02c4..7fb9c7538 100644 --- a/includes/dhctoken.h +++ b/includes/dhctoken.h @@ -308,7 +308,8 @@ enum dhcp_token { TOKEN_CLOSE = 603, TOKEN_CREATE = 604, TOKEN_OPEN = 605, - TOKEN_HELP = 606 + TOKEN_HELP = 606, + END_OF_FILE = 607 }; #define is_identifier(x) ((x) >= FIRST_TOKEN && \ diff --git a/server/confpars.c b/server/confpars.c index ed2d02575..86e5555ca 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -3,7 +3,7 @@ Parser for dhcpd config file... */ /* - * Copyright (c) 1995-2000 Internet Software Consortium. + * Copyright (c) 1995-2001 Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: confpars.c,v 1.133 2001/02/12 21:59:30 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: confpars.c,v 1.134 2001/03/01 18:17:07 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -65,7 +65,7 @@ void parse_trace_setup () } #endif -/* conf-file :== parameters declarations EOF +/* conf-file :== parameters declarations END_OF_FILE parameters :== | parameter | parameters parameter declarations :== | declaration | declarations declaration */ @@ -225,7 +225,7 @@ void trace_conf_input (trace_type_t *ttype, unsigned len, char *data) void trace_conf_stop (trace_type_t *ttype) { } #endif -/* conf-file :== parameters declarations EOF +/* conf-file :== parameters declarations END_OF_FILE parameters :== | parameter | parameters parameter declarations :== | declaration | declarations declaration */ @@ -239,7 +239,7 @@ isc_result_t conf_file_subparse (struct parse *cfile, struct group *group, do { token = peek_token (&val, cfile); - if (token == EOF) + if (token == END_OF_FILE) break; declaration = parse_statement (cfile, group, group_type, (struct host_decl *)0, @@ -251,7 +251,7 @@ isc_result_t conf_file_subparse (struct parse *cfile, struct group *group, return status; } -/* lease-file :== lease-declarations EOF +/* lease-file :== lease-declarations END_OF_FILE lease-statments :== | lease-declaration | lease-declarations lease-declaration */ @@ -264,7 +264,7 @@ isc_result_t lease_file_subparse (struct parse *cfile) do { token = next_token (&val, cfile); - if (token == EOF) + if (token == END_OF_FILE) break; if (token == LEASE) { struct lease *lease = (struct lease *)0; @@ -1496,7 +1496,7 @@ void parse_host_declaration (cfile, group) token = next_token (&val, cfile); break; } - if (token == EOF) { + if (token == END_OF_FILE) { token = next_token (&val, cfile); parse_warn (cfile, "unexpected end of file"); break; @@ -1838,7 +1838,7 @@ int parse_class_declaration (cp, cfile, group, type) if (token == RBRACE) { token = next_token (&val, cfile); break; - } else if (token == EOF) { + } else if (token == END_OF_FILE) { token = next_token (&val, cfile); parse_warn (cfile, "unexpected end of file"); break; @@ -2028,7 +2028,7 @@ void parse_shared_net_declaration (cfile, group) enter_shared_network (share); shared_network_dereference (&share, MDL); return; - } else if (token == EOF) { + } else if (token == END_OF_FILE) { token = next_token (&val, cfile); parse_warn (cfile, "unexpected end of file"); break; @@ -2123,7 +2123,7 @@ void parse_subnet_declaration (cfile, share) if (token == RBRACE) { token = next_token (&val, cfile); break; - } else if (token == EOF) { + } else if (token == END_OF_FILE) { token = next_token (&val, cfile); parse_warn (cfile, "unexpected end of file"); break; @@ -2213,7 +2213,7 @@ void parse_group_declaration (cfile, group) if (token == RBRACE) { token = next_token (&val, cfile); break; - } else if (token == EOF) { + } else if (token == END_OF_FILE) { token = next_token (&val, cfile); parse_warn (cfile, "unexpected end of file"); break; @@ -2387,7 +2387,7 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile) token = next_token (&val, cfile); if (token == RBRACE) break; - else if (token == EOF) { + else if (token == END_OF_FILE) { parse_warn (cfile, "unexpected end of file"); break; }