From c79cc497e7b0caa0f9f6a2c978fa9a5f0f097463 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 15 Oct 2008 13:39:40 +0200 Subject: [PATCH] make extended syntax on uci show optional (but enabled by default) --- cli.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli.c b/cli.c index 61afa80..36ef6e5 100644 --- a/cli.c +++ b/cli.c @@ -26,6 +26,7 @@ static enum { CLI_FLAG_QUIET = (1 << 1), CLI_FLAG_NOCOMMIT = (1 << 2), CLI_FLAG_BATCH = (1 << 3), + CLI_FLAG_SHOW_EXT = (1 << 4), } flags; static FILE *input; @@ -84,7 +85,7 @@ uci_lookup_section_ref(struct uci_section *s) struct uci_type_list *ti = type_list; int maxlen; - if (!s->anonymous) + if (!s->anonymous || !(flags & CLI_FLAG_SHOW_EXT)) return s->e.name; /* look up in section type list */ @@ -143,6 +144,7 @@ static void uci_usage(void) "\t-q quiet mode (don't print error messages)\n" "\t-s force strict mode (stop on parser errors, default)\n" "\t-S disable strict mode\n" + "\t-X do not use extended syntax on 'show'\n" "\n", appname ); @@ -592,6 +594,7 @@ int main(int argc, char **argv) int ret; int c; + flags = CLI_FLAG_SHOW_EXT; appname = argv[0]; input = stdin; ctx = uci_alloc_context(); @@ -600,7 +603,7 @@ int main(int argc, char **argv) return 1; } - while((c = getopt(argc, argv, "c:d:f:mnNp:P:sSq")) != -1) { + while((c = getopt(argc, argv, "c:d:f:mnNp:P:sSqX")) != -1) { switch(c) { case 'c': uci_set_confdir(ctx, optarg); @@ -642,6 +645,9 @@ int main(int argc, char **argv) case 'q': flags |= CLI_FLAG_QUIET; break; + case 'X': + flags &= ~CLI_FLAG_SHOW_EXT; + break; default: uci_usage(); return 0; -- 2.41.1