From: Felix Fietkau Date: Tue, 19 Aug 2008 20:28:07 +0000 (+0200) Subject: correctly show list changes in "uci changes" output X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=commitdiff_plain;h=3d3ff6257506378fb436bfe8b7bcd4d2deaafb5e;ds=sidebyside correctly show list changes in "uci changes" output --- diff --git a/cli.c b/cli.c index b48567f..fe99970 100644 --- a/cli.c +++ b/cli.c @@ -155,14 +155,24 @@ static void uci_show_changes(struct uci_package *p) uci_foreach_element(&p->saved_history, e) { struct uci_history *h = uci_to_history(e); + char *prefix = ""; + char *op = "="; - if (h->cmd == UCI_CMD_REMOVE) - printf("-"); - printf("%s.%s", p->e.name, h->section); + switch(h->cmd) { + case UCI_CMD_REMOVE: + prefix = "-"; + break; + case UCI_CMD_LIST_ADD: + op = "+="; + break; + default: + break; + } + printf("%s%s.%s", prefix, p->e.name, h->section); if (e->name) printf(".%s", e->name); if (h->cmd != UCI_CMD_REMOVE) - printf("=%s", h->value); + printf("%s%s", op, h->value); printf("\n"); } }