diff options
Diffstat (limited to 'src/cli_parse.y')
-rw-r--r-- | src/cli_parse.y | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/cli_parse.y b/src/cli_parse.y index dd3d7d2..89c6638 100644 --- a/src/cli_parse.y +++ b/src/cli_parse.y @@ -89,8 +89,45 @@ otherinput: type EOL ; tag: /* empty */ - | TAG EOL {parse_defp->tag = TRUE;} + | TAG EOL {parse_defp->tag = TRUE;} + | TAG VALUE { + parse_defp->tag = TRUE; + 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 *) + "Tag must be <u32>\n"); + } else { + parse_defp->def_tag = cval; + } + } | MULTI EOL {parse_defp->multi = TRUE;} + | MULTI VALUE + { + parse_defp->multi = TRUE; + 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 *) + "Tag must be <u32>\n"); + } else { + parse_defp->def_multi = cval; + } + } ; type: TYPE TYPE_DEF SEMI STRING |