diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-07-28 14:30:32 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-07-28 14:30:32 -0700 |
commit | 639c835bc2730a4fbffd915f5b2028a68375ee7a (patch) | |
tree | 203d61e1d5e8ef422d6aba3851d2f83a1f838b6b /src/cli_parse.y | |
parent | 0247864ef578ac05bbac8dc5175e674ce7b82714 (diff) | |
download | vyatta-cfg-639c835bc2730a4fbffd915f5b2028a68375ee7a.tar.gz vyatta-cfg-639c835bc2730a4fbffd915f5b2028a68375ee7a.zip |
add new cstore library
Diffstat (limited to 'src/cli_parse.y')
-rw-r--r-- | src/cli_parse.y | 47 |
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);} ; |