diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-04-11 20:16:52 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-04-11 20:39:16 +0200 |
commit | 390ba3faa02992842093fc0a262222ec1441a69d (patch) | |
tree | f1aba44e72227b9c3dbf96d2914a4b95d8874200 | |
parent | cfccedd74a9d7e199613c077ed82accd400611e2 (diff) |
ipaccess-config: Add option to list possible NVRAM settings
We can handle NVRAM settings via names but there is no way
to discover these names. This commits adds the unusual -H
option to show these values.
-rw-r--r-- | openbsc/src/ipaccess/ipaccess-config.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index 1987e50cf..34cb3b4f3 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -697,11 +697,30 @@ static void print_help(void) printf("\n"); printf("Miscellaneous commands:\n"); printf(" -h --help\t\t\tthis text\n"); + printf(" -H --HELP\t\t\tPrint parameter details.\n"); printf(" -f --firmware FIRMWARE\tProvide firmware information\n"); printf(" -w --write-firmware\t\tThis will dump the firmware parts to the filesystem. Use with -f.\n"); printf(" -p --loop\t\t\tLoop the tests executed with the --listen command.\n"); } +static void print_value_string(const struct value_string *val, int size) +{ + int i; + + for (i = 0; i < size - 1; ++i) { + char sep = val[i + 1].str == NULL ? '.' : ','; + printf("%s%c ", val[i].str, sep); + } + printf("\n"); +} + +static void print_options(void) +{ + + printf("Options for NVRAM (-S,-U):\n "); + print_value_string(&ipa_nvflag_strs[0], ARRAY_SIZE(ipa_nvflag_strs)); +} + extern void bts_model_nanobts_init(); int main(int argc, char **argv) @@ -736,6 +755,7 @@ int main(int argc, char **argv) { "nvattr-set", 1, 0, 'S' }, { "nvattr-unset", 1, 0, 'U' }, { "help", 0, 0, 'h' }, + { "HELP", 0, 0, 'H' }, { "listen", 1, 0, 'l' }, { "stream-id", 1, 0, 's' }, { "software", 1, 0, 'd' }, @@ -746,7 +766,7 @@ int main(int argc, char **argv) { 0, 0, 0, 0 }, }; - c = getopt_long(argc, argv, "u:o:i:g:rn:S:U:l:hs:d:f:wcp", long_options, + c = getopt_long(argc, argv, "u:o:i:g:rn:S:U:l:hs:d:f:wcpH", long_options, &option_index); if (c == -1) @@ -817,6 +837,9 @@ int main(int argc, char **argv) print_usage(); print_help(); exit(0); + case 'H': + print_options(); + exit(0); } }; |