From 3d3ff6257506378fb436bfe8b7bcd4d2deaafb5e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 19 Aug 2008 22:28:07 +0200 Subject: [PATCH] correctly show list changes in "uci changes" output --- cli.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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"); } } -- 2.11.0