add some missing initializations
[project/uci.git] / cli.c
diff --git a/cli.c b/cli.c
index 5a260ef..46da45a 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -187,13 +187,7 @@ static int package_cmd(int cmd, char *tuple)
                return 1;
        }
 
-       if (ptr.o)
-               e = &ptr.o->e;
-       else if (ptr.s)
-               e = &ptr.s->e;
-       else
-               e = &ptr.p->e;
-
+       e = ptr.last;
        switch(cmd) {
        case CMD_CHANGES:
                uci_show_changes(ptr.p);
@@ -341,13 +335,7 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv)
        if (ptr.value && (cmd != CMD_SET) && (cmd != CMD_ADD_LIST) && (cmd != CMD_RENAME))
                return 1;
 
-       if (ptr.o)
-               e = &ptr.o->e;
-       else if (ptr.s)
-               e = &ptr.s->e;
-       else
-               e = &ptr.p->e;
-
+       e = ptr.last;
        switch(cmd) {
        case CMD_GET:
                switch(e->type) {
@@ -366,10 +354,10 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv)
                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:
-               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);
@@ -482,7 +470,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;