FreeCalypso > hg > freecalypso-tools
changeset 119:6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 18 Feb 2017 07:54:38 +0000 |
parents | 9aeabcbe6a3d |
children | 12dbb47ad3f7 |
files | rvinterf/tmsh/l1cmd.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/tmsh/l1cmd.c Sat Feb 18 07:49:29 2017 +0000 +++ b/rvinterf/tmsh/l1cmd.c Sat Feb 18 07:54:38 2017 +0000 @@ -174,13 +174,20 @@ return(0); } +static struct kwtab stats_read_arg[] = { + {"accum", ACCUMULATED_RX_STATS}, + {"most-recent", MOST_RECENT_RX_STATS}, + {0, 0} +}; + cmd_sr(argc, argv) char **argv; { u16 type, bitmask; u_char cmdpkt[7]; - type = strtoul(argv[1], 0, 0); + if (keyword_or_num(argv[1], stats_read_arg, &type)) + return(ERROR_USAGE); bitmask = strtoul(argv[2], 0, 16); cmdpkt[1] = STATS_READ; cmdpkt[2] = type;