summaryrefslogtreecommitdiff
path: root/src/cli_parse.y
diff options
context:
space:
mode:
authorrbalocca <rbalocca@vyatta.com>2008-06-29 18:05:08 -0700
committerrbalocca <rbalocca@vyatta.com>2008-06-29 18:05:08 -0700
commit7db066e99a5e9c3b41ce30d19b9781b1a8df8d44 (patch)
tree75da49d74a9da7cb6df98651ef511ddd12a42790 /src/cli_parse.y
parentdd1921164c972be0333d8b90f7c12f31f67a136e (diff)
parent3b1043be67c60220c107e42998635c628eb84393 (diff)
downloadvyatta-cfg-7db066e99a5e9c3b41ce30d19b9781b1a8df8d44.tar.gz
vyatta-cfg-7db066e99a5e9c3b41ce30d19b9781b1a8df8d44.zip
Merge branch 'hollywood'
Diffstat (limited to 'src/cli_parse.y')
-rw-r--r--src/cli_parse.y27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/cli_parse.y b/src/cli_parse.y
index 6378bc9..dd3d7d2 100644
--- a/src/cli_parse.y
+++ b/src/cli_parse.y
@@ -1,8 +1,12 @@
%{
-
#include <assert.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#define __USE_ISOC99
+#include <limits.h>
#include "cli_val.h"
@@ -30,6 +34,7 @@ static void cli_deferror(const char *);
%token TYPE
%token HELP
%token DEFAULT
+%token PRIORITY
%token PATTERN
%token EXEC
%token SYNTAX
@@ -101,6 +106,7 @@ type: TYPE TYPE_DEF
cause: help_cause
| default_cause
+ | priority_stmt
| syntax_cause
| ACTION action { append(parse_defp->actions + $1, $2, 0);}
| dummy_stmt
@@ -126,6 +132,25 @@ default_cause: DEFAULT STRING
parse_defp->def_default = $2;
}
+priority_stmt: PRIORITY VALUE
+ {
+ char *tmp = $2.val;
+ long long int cval = 0;
+ char *endp = NULL;
+ errno = 0;
+ cval = strtoll(tmp, &endp, 10);
+ if (($2.val_type != INT_TYPE)
+ || (errno == ERANGE
+ && (cval == LLONG_MAX || cval == LLONG_MIN))
+ || (errno != 0 && cval == 0)
+ || (*endp != '\0') || (cval < 0) || (cval > UINT_MAX)) {
+ yy_cli_parse_error((const char *)
+ "Priority must be <u32>\n");
+ } else {
+ parse_defp->def_priority = cval;
+ }
+ }
+
syntax_cause: SYNTAX exp {append(parse_defp->actions + syntax_act, $2, 0);}
;