2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 14:25:41 +00:00

Add X code to option parser to handle data that might be ASCII text or colon-seperated hexadecimal octets

This commit is contained in:
Ted Lemon
1996-06-01 00:16:30 +00:00
parent d64820ba4e
commit 973bd37a42
2 changed files with 68 additions and 0 deletions

View File

@@ -923,6 +923,40 @@ void parse_option_decl (cfile, bc, options)
if (*fmt == 'A')
break;
switch (*fmt) {
case 'X':
token = peek_token (&val, cfile);
if (token == NUMBER_OR_ATOM ||
token == NUMBER) {
do {
token = next_token
(&val, cfile);
if (token != NUMBER
&& token != NUMBER_OR_ATOM)
goto need_number;
convert_num (buf, val, 16, 8);
tree = tree_concat
(tree,
tree_const (buf, 1));
token = peek_token
(&val, cfile);
if (token == COLON)
token = next_token
(&val, cfile);
} while (token == COLON);
} else if (token == STRING) {
token = next_token (&val, cfile);
tree = tree_concat
(tree,
tree_const (val,
strlen (val)));
} else {
parse_warn ("expecting string %s."
"or hexadecimal data");
skip_to_semi (cfile);
longjmp (jdref (bc), 1);
}
break;
case 't': /* Text string... */
token = next_token (&val, cfile);
if (token != STRING