FreeCalypso > hg > freecalypso-tools
diff rvinterf/tmsh/l1cmd.c @ 118:9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 18 Feb 2017 07:49:29 +0000 |
parents | c91500530216 |
children | 6ce20d48e9ee |
line wrap: on
line diff
--- a/rvinterf/tmsh/l1cmd.c Sat Feb 18 07:44:12 2017 +0000 +++ b/rvinterf/tmsh/l1cmd.c Sat Feb 18 07:49:29 2017 +0000 @@ -131,13 +131,24 @@ return(0); } +static struct kwtab stats_config_arg[] = { + {"loops", LOOPS}, + {"auto-result-loops", AUTO_RESULT_LOOPS}, + {"auto-reset-loops", AUTO_RESET_LOOPS}, + {"stat-gprs-slots", STAT_GPRS_SLOTS}, + {"stat-type", STAT_TYPE}, + {"stat-bitmask", STAT_BITMASK}, + {0, 0} +}; + cmd_scw(argc, argv) char **argv; { u16 index, value; u_char cmdpkt[7]; - index = strtoul(argv[1], 0, 0); + if (keyword_or_num(argv[1], stats_config_arg, &index)) + return(ERROR_USAGE); value = strtoul(argv[2], 0, 0); cmdpkt[1] = STATS_CONFIG_WRITE; cmdpkt[2] = index; @@ -154,7 +165,8 @@ u16 index; u_char cmdpkt[5]; - index = strtoul(argv[1], 0, 0); + if (keyword_or_num(argv[1], stats_config_arg, &index)) + return(ERROR_USAGE); cmdpkt[1] = STATS_CONFIG_READ; cmdpkt[2] = index; cmdpkt[3] = index >> 8;