X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=cli.c;h=3188bd19d2925cd8c7d34e985780fb079d45498b;hp=cdd1838e1b2a17f15ed9a480c403661b32e3e65c;hb=031b620e1f3a16078da45ce00352508764902786;hpb=3d22ffb838d306fc87c3701fa79a2d4198a4720d diff --git a/cli.c b/cli.c index cdd1838..3188bd1 100644 --- a/cli.c +++ b/cli.c @@ -1,4 +1,5 @@ /* + * cli - Command Line Interface for the Unified Configuration Interface * Copyright (C) 2008 Felix Fietkau * * This program is free software; you can redistribute it and/or modify @@ -11,41 +12,78 @@ * GNU General Public License for more details. */ #include +#include #include #include #include "uci.h" -static const char *appname = "uci"; +#define MAX_ARGS 4 /* max command line arguments for batch mode */ + +static const char *appname; +static enum { + CLI_FLAG_MERGE = (1 << 0), + CLI_FLAG_QUIET = (1 << 1), + CLI_FLAG_NOCOMMIT = (1 << 2), + CLI_FLAG_BATCH = (1 << 3), +} flags; + +static FILE *input; static struct uci_context *ctx; enum { /* section cmds */ - CMD_GET = 1, - CMD_SET = 2, - CMD_DEL = 3, + CMD_GET, + CMD_SET, + CMD_DEL, + CMD_RENAME, + CMD_REVERT, /* package cmds */ - CMD_SHOW = 4, - CMD_EXPORT = 5, - CMD_COMMIT = 6, + CMD_SHOW, + CMD_CHANGES, + CMD_EXPORT, + CMD_COMMIT, + /* other cmds */ + CMD_IMPORT, + CMD_HELP, }; -static void uci_usage(int argc, char **argv) +static int uci_cmd(int argc, char **argv); + +static void uci_usage(void) { fprintf(stderr, "Usage: %s [] []\n\n" "Commands:\n" - "\texport []\n" - "\tshow [[.
[.