summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/command_graph.c6
-rw-r--r--lib/command_graph.h8
-rw-r--r--lib/command_lex.l4
-rw-r--r--lib/command_match.c6
-rw-r--r--lib/command_parse.y9
-rw-r--r--lib/grammar_sandbox.c5
6 files changed, 19 insertions, 19 deletions
diff --git a/lib/command_graph.c b/lib/command_graph.c
index d420b1c063..50be35044a 100644
--- a/lib/command_graph.c
+++ b/lib/command_graph.c
@@ -125,7 +125,7 @@ describe_node(struct graph_node *node, char* buffer, unsigned int bufsize)
snprintf(buffer, bufsize, node->text);
break;
case NUMBER_GN:
- snprintf(buffer, bufsize, "%ld", node->value);
+ snprintf(buffer, bufsize, "%lld", node->value);
break;
case SELECTOR_GN:
snprintf(buffer, bufsize, "<>");
@@ -182,10 +182,10 @@ dump_node (struct graph_node *node)
describe_node(node, buf, 50);
fprintf(stderr, "%s[%d]\n", buf, node->type);
fprintf(stderr, "\t->text: %s\n", node->text);
- fprintf(stderr, "\t->value: %ld\n", node->value);
+ fprintf(stderr, "\t->value: %lld\n", node->value);
fprintf(stderr, "\t->is_start: %d\n", node->is_start);
fprintf(stderr, "\t->element: %p\n", node->element);
- fprintf(stderr, "\t->min: %d\n->max: %d\n", node->min, node->max);
+ fprintf(stderr, "\t->min: %lld\n->max: %lld\n", node->min, node->max);
fprintf(stderr, "\t->arg: %s\n", node->arg);
fprintf(stderr, "\t->refs: %d\n", node->refs);
fprintf(stderr, "\tnum children: %d\n", vector_active(node->children));
diff --git a/lib/command_graph.h b/lib/command_graph.h
index 925133c203..e1feb9f77f 100644
--- a/lib/command_graph.h
+++ b/lib/command_graph.h
@@ -23,13 +23,13 @@ enum graph_node_type
struct graph_node
{
enum graph_node_type type;// data type this node matches or holds
- int is_start; // whether this node is a start node
+ unsigned int is_start; // whether this node is a start node
vector children; // this node's children
struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN
char* text; // for WORD_GN and VARIABLE_GN
- long value; // for NUMBER_GN
- int min, max; // for RANGE_GN
+ long long value; // for NUMBER_GN
+ long long min, max; // for RANGE_GN
/* cmd_element struct pointer, only valid for END_GN */
struct cmd_element *element;
@@ -37,7 +37,7 @@ struct graph_node
char *arg;
/* refcount for node parents */
- int refs;
+ unsigned int refs;
};
/*
diff --git a/lib/command_lex.l b/lib/command_lex.l
index 47723cbf91..855cf9a065 100644
--- a/lib/command_lex.l
+++ b/lib/command_lex.l
@@ -4,13 +4,13 @@
extern void set_buffer_string(const char *);
%}
-WORD [-|+]?[a-z\*][-+_a-zA-Z0-9\*]*
+WORD (\-|\+)?[a-z\*][-+_a-zA-Z0-9\*]*
IPV4 A\.B\.C\.D
IPV4_PREFIX A\.B\.C\.D\/M
IPV6 X:X::X:X
IPV6_PREFIX X:X::X:X\/M
VARIABLE [A-Z][-_a-zA-Z:0-9]+
-NUMBER [-|+]?[0-9]{1,20}
+NUMBER (\-|\+)?[0-9]{1,20}
RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\)
/* yytext shall be a pointer */
diff --git a/lib/command_match.c b/lib/command_match.c
index aac2edc482..eaacce027f 100644
--- a/lib/command_match.c
+++ b/lib/command_match.c
@@ -636,12 +636,12 @@ static enum match_type
match_range (struct graph_node *rangenode, const char *str)
{
char *endptr = NULL;
- signed int val;
+ long long val;
if (str == NULL)
return 1;
- val = strtoimax (str, &endptr, 10);
+ val = strtoll (str, &endptr, 10);
if (*endptr != '\0')
return 0;
@@ -674,7 +674,7 @@ match_number(struct graph_node *numnode, const char *word)
{
if (!strcmp("\0", word)) return no_match;
char *endptr;
- int num = strtoimax(word, &endptr, 10);
+ long long num = strtoll (word, &endptr, 10);
if (endptr != '\0') return no_match;
return num == numnode->value ? exact_match : no_match;
}
diff --git a/lib/command_parse.y b/lib/command_parse.y
index 0ea8744346..ac075e67a3 100644
--- a/lib/command_parse.y
+++ b/lib/command_parse.y
@@ -36,7 +36,7 @@ node_replace(struct graph_node *, struct graph_node *);
/* valid types for tokens */
%union{
- signed int integer;
+ long long integer;
char *string;
struct graph_node *node;
}
@@ -205,9 +205,10 @@ placeholder_token:
$$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1);
// get the numbers out
- $$->min = strtoimax( yylval.string+1, &yylval.string, 10 );
+ yylval.string++;
+ $$->min = strtoll( yylval.string, &yylval.string, 10 );
strsep (&yylval.string, "-");
- $$->max = strtoimax( yylval.string, &yylval.string, 10 );
+ $$->max = strtoll( yylval.string, &yylval.string, 10 );
// validate range
if ($$->min >= $$->max) yyerror("Invalid range.");
@@ -352,7 +353,7 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd)
optnode_start = optnode_end = NULL;
// trace parser
- yydebug = 1;
+ yydebug = 0;
// command string
command = cmd;
// make flex read from a string
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 0eb8d69cee..a2177c1767 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -32,9 +32,8 @@ DEFUN (grammar_test_show,
{
if (!nodegraph)
fprintf(stderr, "!nodegraph\n");
- fprintf(stderr, "trying to print nodegraph->type\n");
- fprintf(stderr, "%d\n", nodegraph->type);
- walk_graph(nodegraph, 0);
+ else
+ walk_graph(nodegraph, 0);
return CMD_SUCCESS;
}