summaryrefslogtreecommitdiff
path: root/src/cli_parse.y
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-08-18 13:33:43 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-08-18 13:33:43 -0700
commit14df7aa3c937ed8907bd7e9b2657526233691803 (patch)
tree77e876ba2739e7fe396e93b8fd908df845d60d51 /src/cli_parse.y
parentabc2986d38f4b6f7a7ccc0fd3fb10e4f21652209 (diff)
parent3594ffa9f1c62d5f73d12b35f81a862c762b5d44 (diff)
downloadvyatta-cfg-14df7aa3c937ed8907bd7e9b2657526233691803.tar.gz
vyatta-cfg-14df7aa3c937ed8907bd7e9b2657526233691803.zip
Merge branch 'mendocino' of suva.vyatta.com:/git/vyatta-cfg into mendocino
Diffstat (limited to 'src/cli_parse.y')
-rw-r--r--src/cli_parse.y47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/cli_parse.y b/src/cli_parse.y
index 318394b..47ba0e5 100644
--- a/src/cli_parse.y
+++ b/src/cli_parse.y
@@ -35,6 +35,10 @@ static void cli_deferror(const char *);
%token HELP
%token DEFAULT
%token PRIORITY
+%token ENUMERATION
+%token CHELP
+%token ALLOWED
+%token VHELP
%token PATTERN
%token EXEC
%token SYNTAX
@@ -150,6 +154,10 @@ type: TYPE TYPE_DEF
cause: help_cause
| default_cause
| priority_stmt
+ | enumeration_stmt
+ | chelp_stmt
+ | allowed_stmt
+ | vhelp_stmt
| syntax_cause
| ACTION action { append(parse_defp->actions + $1, $2, 0);}
| dummy_stmt
@@ -191,6 +199,45 @@ priority_stmt: PRIORITY VALUE
}
}
+enumeration_stmt: ENUMERATION STRING
+ {
+ parse_defp->def_enumeration = $2;
+ }
+
+chelp_stmt: CHELP STRING
+ {
+ parse_defp->def_comp_help = $2;
+ }
+
+allowed_stmt: ALLOWED STRING
+ {
+ parse_defp->def_allowed = $2;
+ }
+
+vhelp_stmt: VHELP STRING
+ {
+ if (!(parse_defp->def_val_help)) {
+ /* first string */
+ parse_defp->def_val_help = $2;
+ } else {
+ /* subsequent strings */
+ char *optr = parse_defp->def_val_help;
+ int olen = strlen(parse_defp->def_val_help);
+ char *nptr = $2;
+ int nlen = strlen(nptr);
+ int len = olen + 1 /* "\n" */ + nlen + 1 /* 0 */;
+ char *mptr = (char *) malloc(len);
+ memcpy(mptr, optr, olen);
+ mptr[olen] = '\n';
+ memcpy(&(mptr[olen + 1]), nptr, nlen);
+ mptr[len - 1] = 0;
+ parse_defp->def_val_help = mptr;
+ free(optr);
+ free(nptr);
+ }
+ /* result is a '\n'-delimited string for val_help */
+ }
+
syntax_cause: SYNTAX exp {append(parse_defp->actions + syntax_act, $2, 0);}
;