projects
/
project
/
uci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
extend uci_set so that it can store the resulting element in a variable
[project/uci.git]
/
cli.c
diff --git
a/cli.c
b/cli.c
index
dadadaa
..
95bc34e
100644
(file)
--- a/
cli.c
+++ b/
cli.c
@@
-12,6
+12,7
@@
* GNU General Public License for more details.
*/
#include <strings.h>
* GNU General Public License for more details.
*/
#include <strings.h>
+#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "uci.h"
#include <stdlib.h>
#include <unistd.h>
#include "uci.h"
@@
-56,6
+57,7
@@
static void uci_usage(void)
"\tbatch\n"
"\texport [<config>]\n"
"\timport [<config>]\n"
"\tbatch\n"
"\texport [<config>]\n"
"\timport [<config>]\n"
+ "\tchanges [<config>]\n"
"\tshow [<config>[.<section>[.<option>]]]\n"
"\tget <config>.<section>[.<option>]\n"
"\tset <config>.<section>[.<option>]=<value>\n"
"\tshow [<config>[.<section>[.<option>]]]\n"
"\tget <config>.<section>[.<option>]\n"
"\tset <config>.<section>[.<option>]=<value>\n"
@@
-169,6
+171,7
@@
static int uci_do_import(int argc, char **argv)
struct uci_package *package = NULL;
char *name = NULL;
int ret = UCI_OK;
struct uci_package *package = NULL;
char *name = NULL;
int ret = UCI_OK;
+ bool merge = false;
if (argc > 2)
return 255;
if (argc > 2)
return 255;
@@
-182,10
+185,12
@@
static int uci_do_import(int argc, char **argv)
if (flags & CLI_FLAG_MERGE) {
if (uci_load(ctx, name, &package) != UCI_OK)
package = NULL;
if (flags & CLI_FLAG_MERGE) {
if (uci_load(ctx, name, &package) != UCI_OK)
package = NULL;
+ else
+ merge = true;
}
ret = uci_import(ctx, input, name, &package, (name != NULL));
if (ret == UCI_OK) {
}
ret = uci_import(ctx, input, name, &package, (name != NULL));
if (ret == UCI_OK) {
- if (
flags & CLI_FLAG_MERGE
) {
+ if (
merge
) {
ret = uci_save(ctx, package);
} else {
struct uci_element *e;
ret = uci_save(ctx, package);
} else {
struct uci_element *e;
@@
-287,7
+292,7
@@
static int uci_do_section_cmd(int cmd, int argc, char **argv)
ret = uci_revert(ctx, &p, section, option);
break;
case CMD_SET:
ret = uci_revert(ctx, &p, section, option);
break;
case CMD_SET:
- ret = uci_set(ctx, p, section, option, value);
+ ret = uci_set(ctx, p, section, option, value
, NULL
);
break;
case CMD_DEL:
ret = uci_delete(ctx, p, section, option);
break;
case CMD_DEL:
ret = uci_delete(ctx, p, section, option);