X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=file.c;h=fe52876fa446001cfa1562653b157fc9a9bc6178;hp=c6ea7b485343923fda69324b2f124e308c4294aa;hb=b69b459ecce221f92235d0def138ff4af3c22543;hpb=6042bb553c8660cc649a3f0eed0d932878b10cac diff --git a/file.c b/file.c index c6ea7b4..fe52876 100644 --- a/file.c +++ b/file.c @@ -639,6 +639,7 @@ static void uci_close_stream(FILE *stream) static void uci_parse_history_line(struct uci_context *ctx, struct uci_package *p, char *buf) { bool delete = false; + bool rename = false; char *package = NULL; char *section = NULL; char *option = NULL; @@ -647,6 +648,9 @@ static void uci_parse_history_line(struct uci_context *ctx, struct uci_package * if (buf[0] == '-') { delete = true; buf++; + } else if (buf[0] == '@') { + rename = true; + buf++; } UCI_INTERNAL(uci_parse_tuple, ctx, buf, &package, §ion, &option, &value); @@ -659,8 +663,10 @@ static void uci_parse_history_line(struct uci_context *ctx, struct uci_package * if (option && !uci_validate_name(option)) goto error; - if (delete) - UCI_INTERNAL(uci_del, ctx, p, section, option); + if (rename) + UCI_INTERNAL(uci_rename, ctx, p, section, option, value); + else if (delete) + UCI_INTERNAL(uci_delete, ctx, p, section, option); else UCI_INTERNAL(uci_set, ctx, p, section, option, value); @@ -809,6 +815,8 @@ int uci_save(struct uci_context *ctx, struct uci_package *p) if (h->cmd == UCI_CMD_REMOVE) fprintf(f, "-"); + else if (h->cmd == UCI_CMD_RENAME) + fprintf(f, "@"); fprintf(f, "%s.%s", p->e.name, h->section); if (e->name)