diff options
Diffstat (limited to 'keama/conflex.c')
-rw-r--r-- | keama/conflex.c | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/keama/conflex.c b/keama/conflex.c index 09f147f8..9a635732 100644 --- a/keama/conflex.c +++ b/keama/conflex.c @@ -186,7 +186,7 @@ get_char(struct parse *cfile) if (!cfile->ugflag) { if (c == EOL) { - if (cfile->cur_line == cfile->line1) { + if (cfile->cur_line == cfile->line1) { cfile->cur_line = cfile->line2; cfile->prev_line = cfile->line1; } else { @@ -224,11 +224,11 @@ unget_char(struct parse *cfile, int c) { /* * GENERAL NOTE ABOUT TOKENS * - * We normally only want non-whitespace tokens. There are some + * We normally only want non-whitespace tokens. There are some * circumstances where we *do* want to see whitespace (for example * when parsing IPv6 addresses). * - * Generally we use the next_token() function to read tokens. This + * Generally we use the next_token() function to read tokens. This * in turn calls get_next_token, which does *not* return tokens for * whitespace. Rather, it skips these. * @@ -254,7 +254,7 @@ get_raw_token(struct parse *cfile) { p = cfile->lpos; c = get_char(cfile); - if (!((c == '\n') && cfile->eol_token) && + if (!((c == '\n') && cfile->eol_token) && isascii(c) && isspace(c)) { ttok = read_whitespace(c, cfile); break; @@ -301,12 +301,12 @@ get_raw_token(struct parse *cfile) { * The get_next_token() function consumes the next token and * returns it to the caller. * - * Since the code is almost the same for "normal" and "raw" + * Since the code is almost the same for "normal" and "raw" * input, we pass a flag to alter the way it works. */ -static enum dhcp_token -get_next_token(const char **rval, unsigned *rlen, +static enum dhcp_token +get_next_token(const char **rval, unsigned *rlen, struct parse *cfile, isc_boolean_t raw) { int rv; @@ -328,7 +328,7 @@ get_next_token(const char **rval, unsigned *rlen, cfile->token_line = cfile->cur_line; } } - + if (rval) *rval = cfile->tval; if (rlen) @@ -339,10 +339,10 @@ get_next_token(const char **rval, unsigned *rlen, /* * Get the next token from cfile and return it. * - * If rval is non-NULL, set the pointer it contains to + * If rval is non-NULL, set the pointer it contains to * the contents of the token. * - * If rlen is non-NULL, set the integer it contains to + * If rlen is non-NULL, set the integer it contains to * the length of the token. */ @@ -367,8 +367,8 @@ next_raw_token(const char **rval, unsigned *rlen, struct parse *cfile) { * The do_peek_token() function checks the next token without * consuming it, and returns it to the caller. * - * Since the code is almost the same for "normal" and "raw" - * input, we pass a flag to alter the way it works. (See the + * Since the code is almost the same for "normal" and "raw" + * input, we pass a flag to alter the way it works. (See the * warning in the GENERAL NOTES ABOUT TOKENS above though.) */ @@ -405,15 +405,15 @@ do_peek_token(const char **rval, unsigned int *rlen, /* - * Get the next token from cfile and return it, leaving it for a + * Get the next token from cfile and return it, leaving it for a * subsequent call to next_token(). * * Note that it WILL consume whitespace tokens. * - * If rval is non-NULL, set the pointer it contains to + * If rval is non-NULL, set the pointer it contains to * the contents of the token. * - * If rlen is non-NULL, set the integer it contains to + * If rlen is non-NULL, set the integer it contains to * the length of the token. */ @@ -484,7 +484,7 @@ read_whitespace(int c, struct parse *cfile) { c = get_char(cfile); if (c == EOF) return END_OF_FILE; - } while (!((c == '\n') && cfile->eol_token) && + } while (!((c == '\n') && cfile->eol_token) && isascii(c) && isspace(c)); /* @@ -648,7 +648,7 @@ read_number(int c, struct parse *cfile) goto end_read; default: - parse_error(cfile, + parse_error(cfile, "read_number(): impossible case"); } @@ -936,7 +936,7 @@ intern(char *atom, enum dhcp_token dfv) { } break; case 'e': - if (isascii(atom [1]) && + if (isascii(atom [1]) && tolower((unsigned char)atom[1]) == 'x') { if (!strcasecmp(atom + 2, "tract-int")) return EXTRACT_INT; @@ -1035,15 +1035,15 @@ intern(char *atom, enum dhcp_token dfv) { } break; case 'i': - if (!strcasecmp(atom+1, "a-na")) + if (!strcasecmp(atom+1, "a-na")) return IA_NA; - if (!strcasecmp(atom+1, "a-ta")) + if (!strcasecmp(atom+1, "a-ta")) return IA_TA; - if (!strcasecmp(atom+1, "a-pd")) + if (!strcasecmp(atom+1, "a-pd")) return IA_PD; - if (!strcasecmp(atom+1, "aaddr")) + if (!strcasecmp(atom+1, "aaddr")) return IAADDR; - if (!strcasecmp(atom+1, "aprefix")) + if (!strcasecmp(atom+1, "aprefix")) return IAPREFIX; if (!strcasecmp(atom + 1, "nclude")) return INCLUDE; @@ -1332,11 +1332,11 @@ intern(char *atom, enum dhcp_token dfv) { case 's': if (!strcasecmp(atom + 1, "cript")) return SCRIPT; - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'e') { if (!strcasecmp(atom + 2, "arch")) return SEARCH; - if (isascii(atom[2]) && + if (isascii(atom[2]) && tolower((unsigned char)atom[2]) == 'c') { if (!strncasecmp(atom + 3, "ond", 3)) { if (!strcasecmp(atom + 6, "ary")) @@ -1366,7 +1366,7 @@ intern(char *atom, enum dhcp_token dfv) { return TOKEN_SERVER; if (atom[6] == '-') { if (!strcasecmp(atom + 7, - "duid")) + "duid")) return SERVER_DUID; if (!strcasecmp(atom + 7, "name")) @@ -1386,7 +1386,7 @@ intern(char *atom, enum dhcp_token dfv) { return TOKEN_SET; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'h') { if (!strcasecmp(atom + 2, "ared-network")) return SHARED_NETWORK; @@ -1394,7 +1394,7 @@ intern(char *atom, enum dhcp_token dfv) { return SHUTDOWN; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'i') { if (!strcasecmp(atom + 2, "addr")) return SIADDR; @@ -1404,9 +1404,9 @@ intern(char *atom, enum dhcp_token dfv) { return SIZE; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'p') { - if (isascii(atom[2]) && + if (isascii(atom[2]) && tolower((unsigned char)atom[2]) == 'a') { if (!strcasecmp(atom + 3, "ce")) return SPACE; @@ -1418,9 +1418,9 @@ intern(char *atom, enum dhcp_token dfv) { return SPLIT; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 't') { - if (isascii(atom[2]) && + if (isascii(atom[2]) && tolower((unsigned char)atom[2]) == 'a') { if (!strncasecmp(atom + 3, "rt", 2)) { if (!strcasecmp(atom + 5, "s")) @@ -1453,7 +1453,7 @@ intern(char *atom, enum dhcp_token dfv) { return SUBSTRING; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'u') { if (!strcasecmp(atom + 2, "ffix")) return SUFFIX; @@ -1547,4 +1547,3 @@ intern(char *atom, enum dhcp_token dfv) { } return dfv; } - |