projects
/
project
/
uci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
extend api to be able to get a full error string instead of printing it
[project/uci.git]
/
cli.c
diff --git
a/cli.c
b/cli.c
index
290dcbf
..
305d9fe
100644
(file)
--- 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:
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);
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:
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);
switch(e->type) {
case UCI_TYPE_SECTION:
printf("%s\n", ptr.s->type);
@@
-354,10
+364,10
@@
static int uci_do_section_cmd(int cmd, int argc, char **argv)
ret = uci_rename(ctx, &ptr);
break;
case CMD_REVERT:
ret = uci_rename(ctx, &ptr);
break;
case CMD_REVERT:
- ret = uci_revert(ctx, &ptr
.p, ptr.section, ptr.option
);
+ ret = uci_revert(ctx, &ptr);
break;
case CMD_SET:
break;
case CMD_SET:
- ret = uci_set(ctx,
ptr.p, ptr.section, ptr.option, ptr.value, NULL
);
+ ret = uci_set(ctx,
&ptr
);
break;
case CMD_ADD_LIST:
ret = uci_add_list(ctx, &ptr);
break;
case CMD_ADD_LIST:
ret = uci_add_list(ctx, &ptr);
@@
-470,7
+480,8
@@
static int uci_cmd(int argc, char **argv)
cmd = CMD_RENAME;
else if (!strcasecmp(argv[0], "revert"))
cmd = CMD_REVERT;
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;
cmd = CMD_DEL;
else if (!strcasecmp(argv[0], "import"))
cmd = CMD_IMPORT;