X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=cli.c;h=305d9fed4b3a83a3118c573b47da51f6bf144313;hp=b7071a11c3874dff8fbbcf19ce7629e35704593f;hb=f8cf80970bb8bd6e4c932b2cb14e57580e090488;hpb=4fb6a564b8eebe01f46766b8238a64d6414ed3ba diff --git a/cli.c b/cli.c index b7071a1..305d9fe 100644 --- a/cli.c +++ b/cli.c @@ -202,6 +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)) { + ctx->err = UCI_ERR_NOTFOUND; + cli_perror(); + return 1; + } switch(e->type) { case UCI_TYPE_PACKAGE: uci_show_package(ptr.p); @@ -338,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); @@ -470,7 +480,8 @@ static int uci_cmd(int argc, char **argv) cmd = CMD_RENAME; else if (!strcasecmp(argv[0], "revert")) cmd = CMD_REVERT; - else if (!strcasecmp(argv[0], "del")) + else if (!strcasecmp(argv[0], "del") || + !strcasecmp(argv[0], "delete")) cmd = CMD_DEL; else if (!strcasecmp(argv[0], "import")) cmd = CMD_IMPORT;