2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 13:57:50 +00:00

Change EOF to END_OF_FILE in tokenizer for enum compatibility.

This commit is contained in:
Ted Lemon
2001-03-01 18:17:09 +00:00
parent 9f8b2a7f67
commit 0b69dcc870
7 changed files with 42 additions and 38 deletions

View File

@@ -3,7 +3,7 @@
Parser for dhclient config and lease files... */ Parser for dhclient config and lease files... */
/* /*
* Copyright (c) 1996-2000 Internet Software Consortium. * Copyright (c) 1996-2001 Internet Software Consortium.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -65,7 +65,7 @@ u_int32_t default_requested_options [] = {
0 0
}; };
/* client-conf-file :== client-declarations EOF /* client-conf-file :== client-declarations END_OF_FILE
client-declarations :== <nil> client-declarations :== <nil>
| client-declaration | client-declaration
| client-declarations client-declaration */ | client-declarations client-declaration */
@@ -114,7 +114,7 @@ isc_result_t read_client_conf ()
do { do {
token = peek_token (&val, cfile); token = peek_token (&val, cfile);
if (token == EOF) if (token == END_OF_FILE)
break; break;
parse_client_statement (cfile, parse_client_statement (cfile,
(struct interface_info *)0, (struct interface_info *)0,
@@ -157,7 +157,7 @@ isc_result_t read_client_conf ()
return status; return status;
} }
/* lease-file :== client-lease-statements EOF /* lease-file :== client-lease-statements END_OF_FILE
client-lease-statements :== <nil> client-lease-statements :== <nil>
| client-lease-statements LEASE client-lease-statement */ | client-lease-statements LEASE client-lease-statement */
@@ -177,7 +177,7 @@ void read_client_leases ()
do { do {
token = next_token (&val, cfile); token = next_token (&val, cfile);
if (token == EOF) if (token == END_OF_FILE)
break; break;
if (token != LEASE) { if (token != LEASE) {
log_error ("Corrupt lease file - possible data loss!"); log_error ("Corrupt lease file - possible data loss!");
@@ -666,7 +666,7 @@ void parse_interface_declaration (cfile, outer_config, name)
do { do {
token = peek_token (&val, cfile); token = peek_token (&val, cfile);
if (token == EOF) { if (token == END_OF_FILE) {
parse_warn (cfile, parse_warn (cfile,
"unterminated interface declaration."); "unterminated interface declaration.");
return; return;
@@ -788,7 +788,7 @@ void parse_client_lease_statement (cfile, is_static)
do { do {
token = peek_token (&val, cfile); token = peek_token (&val, cfile);
if (token == EOF) { if (token == END_OF_FILE) {
parse_warn (cfile, "unterminated lease declaration."); parse_warn (cfile, "unterminated lease declaration.");
return; return;
} }

View File

@@ -3,7 +3,7 @@
Lexical scanner for dhcpd config file... */ Lexical scanner for dhcpd config file... */
/* /*
* Copyright (c) 1995-2000 Internet Software Consortium. * Copyright (c) 1995-2001 Internet Software Consortium.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -208,6 +208,9 @@ static enum dhcp_token get_token (cfile)
cfile -> lexchar = p; cfile -> lexchar = p;
ttok = read_num_or_name (c, cfile); ttok = read_num_or_name (c, cfile);
break; break;
} else if (c == EOF) {
ttok = END_OF_FILE;
break;
} else { } else {
cfile -> lexline = l; cfile -> lexline = l;
cfile -> lexchar = p; cfile -> lexchar = p;

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -139,7 +139,7 @@ void skip_to_rbrace (cfile, brace_count)
return; return;
} }
token = next_token (&val, cfile); token = next_token (&val, cfile);
} while (token != EOF); } while (token != END_OF_FILE);
} }
int parse_semi (cfile) int parse_semi (cfile)
@@ -461,7 +461,7 @@ unsigned char *parse_numeric_aggregate (cfile, buf,
} }
token = next_token (&val, cfile); token = next_token (&val, cfile);
if (token == EOF) { if (token == END_OF_FILE) {
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
} }
@@ -2333,7 +2333,7 @@ int parse_on_statement (result, cfile, lose)
/* Try to even things up. */ /* Try to even things up. */
do { do {
token = next_token (&val, cfile); token = next_token (&val, cfile);
} while (token != EOF && token != RBRACE); } while (token != END_OF_FILE && token != RBRACE);
executable_statement_dereference (result, MDL); executable_statement_dereference (result, MDL);
return 0; return 0;
} }
@@ -2525,7 +2525,7 @@ int parse_if_statement (result, cfile, lose)
/* Try to even things up. */ /* Try to even things up. */
do { do {
token = next_token (&val, cfile); token = next_token (&val, cfile);
} while (token != EOF && token != RBRACE); } while (token != END_OF_FILE && token != RBRACE);
executable_statement_dereference (result, MDL); executable_statement_dereference (result, MDL);
return 0; return 0;
} }

View File

@@ -3,7 +3,7 @@
Parser for /etc/resolv.conf file. */ Parser for /etc/resolv.conf file. */
/* /*
* Copyright (c) 1996-2000 Internet Software Consortium. * Copyright (c) 1996-2001 Internet Software Consortium.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -75,7 +75,7 @@ void read_resolv_conf (parse_time)
do { do {
token = next_token (&val, cfile); token = next_token (&val, cfile);
if (token == EOF) if (token == END_OF_FILE)
break; break;
else if (token == EOL) else if (token == EOL)
continue; continue;

View File

@@ -1,4 +1,4 @@
/* omapictl.c /* omshell.c
Examine and modify omapi objects. */ Examine and modify omapi objects. */
@@ -224,7 +224,7 @@ int main (int argc, char **argv, char **envp)
parse_warn (cfile, "unknown token: %s", val); parse_warn (cfile, "unknown token: %s", val);
break; break;
case EOF: case END_OF_FILE:
break; break;
case TOKEN_HELP: case TOKEN_HELP:
@@ -239,7 +239,7 @@ int main (int argc, char **argv, char **envp)
case TOKEN_NEW: case TOKEN_NEW:
token = next_token (&val, cfile); token = next_token (&val, cfile);
if ((!is_identifier (token) && token != STRING) || if ((!is_identifier (token) && token != STRING) ||
next_token (NULL, cfile) != EOF) next_token (NULL, cfile) != END_OF_FILE)
{ {
printf ("usage: new <object-type>\n"); printf ("usage: new <object-type>\n");
break; break;
@@ -260,7 +260,7 @@ int main (int argc, char **argv, char **envp)
break; break;
case TOKEN_CLOSE: case TOKEN_CLOSE:
if (next_token (NULL, cfile) != EOF) { if (next_token (NULL, cfile) != END_OF_FILE) {
printf ("usage: close\n"); printf ("usage: close\n");
} }
@@ -304,7 +304,7 @@ int main (int argc, char **argv, char **envp)
case TOKEN_CREATE: case TOKEN_CREATE:
case TOKEN_OPEN: case TOKEN_OPEN:
if (next_token (NULL, cfile) != EOF) { if (next_token (NULL, cfile) != END_OF_FILE) {
printf ("usage: %s\n", val); printf ("usage: %s\n", val);
} }
@@ -327,7 +327,7 @@ int main (int argc, char **argv, char **envp)
break; break;
case UPDATE: case UPDATE:
if (next_token (NULL, cfile) != EOF) { if (next_token (NULL, cfile) != END_OF_FILE) {
printf ("usage: %s\n", val); printf ("usage: %s\n", val);
} }

View File

@@ -308,7 +308,8 @@ enum dhcp_token {
TOKEN_CLOSE = 603, TOKEN_CLOSE = 603,
TOKEN_CREATE = 604, TOKEN_CREATE = 604,
TOKEN_OPEN = 605, TOKEN_OPEN = 605,
TOKEN_HELP = 606 TOKEN_HELP = 606,
END_OF_FILE = 607
}; };
#define is_identifier(x) ((x) >= FIRST_TOKEN && \ #define is_identifier(x) ((x) >= FIRST_TOKEN && \

View File

@@ -3,7 +3,7 @@
Parser for dhcpd config file... */ Parser for dhcpd config file... */
/* /*
* Copyright (c) 1995-2000 Internet Software Consortium. * Copyright (c) 1995-2001 Internet Software Consortium.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -65,7 +65,7 @@ void parse_trace_setup ()
} }
#endif #endif
/* conf-file :== parameters declarations EOF /* conf-file :== parameters declarations END_OF_FILE
parameters :== <nil> | parameter | parameters parameter parameters :== <nil> | parameter | parameters parameter
declarations :== <nil> | declaration | declarations declaration */ declarations :== <nil> | 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) { } void trace_conf_stop (trace_type_t *ttype) { }
#endif #endif
/* conf-file :== parameters declarations EOF /* conf-file :== parameters declarations END_OF_FILE
parameters :== <nil> | parameter | parameters parameter parameters :== <nil> | parameter | parameters parameter
declarations :== <nil> | declaration | declarations declaration */ declarations :== <nil> | declaration | declarations declaration */
@@ -239,7 +239,7 @@ isc_result_t conf_file_subparse (struct parse *cfile, struct group *group,
do { do {
token = peek_token (&val, cfile); token = peek_token (&val, cfile);
if (token == EOF) if (token == END_OF_FILE)
break; break;
declaration = parse_statement (cfile, group, group_type, declaration = parse_statement (cfile, group, group_type,
(struct host_decl *)0, (struct host_decl *)0,
@@ -251,7 +251,7 @@ isc_result_t conf_file_subparse (struct parse *cfile, struct group *group,
return status; return status;
} }
/* lease-file :== lease-declarations EOF /* lease-file :== lease-declarations END_OF_FILE
lease-statments :== <nil> lease-statments :== <nil>
| lease-declaration | lease-declaration
| lease-declarations lease-declaration */ | lease-declarations lease-declaration */
@@ -264,7 +264,7 @@ isc_result_t lease_file_subparse (struct parse *cfile)
do { do {
token = next_token (&val, cfile); token = next_token (&val, cfile);
if (token == EOF) if (token == END_OF_FILE)
break; break;
if (token == LEASE) { if (token == LEASE) {
struct lease *lease = (struct lease *)0; struct lease *lease = (struct lease *)0;
@@ -1496,7 +1496,7 @@ void parse_host_declaration (cfile, group)
token = next_token (&val, cfile); token = next_token (&val, cfile);
break; break;
} }
if (token == EOF) { if (token == END_OF_FILE) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
@@ -1838,7 +1838,7 @@ int parse_class_declaration (cp, cfile, group, type)
if (token == RBRACE) { if (token == RBRACE) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
break; break;
} else if (token == EOF) { } else if (token == END_OF_FILE) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
@@ -2028,7 +2028,7 @@ void parse_shared_net_declaration (cfile, group)
enter_shared_network (share); enter_shared_network (share);
shared_network_dereference (&share, MDL); shared_network_dereference (&share, MDL);
return; return;
} else if (token == EOF) { } else if (token == END_OF_FILE) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
@@ -2123,7 +2123,7 @@ void parse_subnet_declaration (cfile, share)
if (token == RBRACE) { if (token == RBRACE) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
break; break;
} else if (token == EOF) { } else if (token == END_OF_FILE) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
@@ -2213,7 +2213,7 @@ void parse_group_declaration (cfile, group)
if (token == RBRACE) { if (token == RBRACE) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
break; break;
} else if (token == EOF) { } else if (token == END_OF_FILE) {
token = next_token (&val, cfile); token = next_token (&val, cfile);
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
@@ -2387,7 +2387,7 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
token = next_token (&val, cfile); token = next_token (&val, cfile);
if (token == RBRACE) if (token == RBRACE)
break; break;
else if (token == EOF) { else if (token == END_OF_FILE) {
parse_warn (cfile, "unexpected end of file"); parse_warn (cfile, "unexpected end of file");
break; break;
} }