summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-08-27 16:31:49 +0200
committerFelix Fietkau <nbd@openwrt.org>2008-08-27 16:31:49 +0200
commit2ade5d42fba9f4eed4b5bba8fbff863b6149d13a (patch)
treef7884f2da545131a7f34078589cdc03933dec5f5
parent12c5b22102873e303e540f886489831461d54ea9 (diff)
downloaduci-2ade5d42fba9f4eed4b5bba8fbff863b6149d13a.tar.gz
report errors on partial lookups for show/get in the cli instead of silently falling back to the last match
-rw-r--r--cli.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cli.c b/cli.c
index 1f08100..305d9fe 100644
--- a/cli.c
+++ b/cli.c
@@ -202,8 +202,11 @@ static int package_cmd(int cmd, char *tuple)
uci_export(ctx, stdout, ptr.p, true);
break;
case CMD_SHOW:
- if (!(ptr.flags & UCI_LOOKUP_COMPLETE))
+ if (!(ptr.flags & UCI_LOOKUP_COMPLETE)) {
+ ctx->err = UCI_ERR_NOTFOUND;
+ cli_perror();
return 1;
+ }
switch(e->type) {
case UCI_TYPE_PACKAGE:
uci_show_package(ptr.p);
@@ -340,6 +343,11 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv)
e = ptr.last;
switch(cmd) {
case CMD_GET:
+ if (!(ptr.flags & UCI_LOOKUP_COMPLETE)) {
+ ctx->err = UCI_ERR_NOTFOUND;
+ cli_perror();
+ return 1;
+ }
switch(e->type) {
case UCI_TYPE_SECTION:
printf("%s\n", ptr.s->type);