From 24c59ffa00d5ba40483a1b0c2bce5e5af2b38a3a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 5 Feb 2008 00:35:24 +0100 Subject: [PATCH] implement batch mode in cli --- cli.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 12 deletions(-) diff --git a/cli.c b/cli.c index 946a905..e05f5d4 100644 --- a/cli.c +++ b/cli.c @@ -16,12 +16,16 @@ #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; @@ -34,16 +38,21 @@ enum { CMD_REVERT, /* package cmds */ CMD_SHOW, - CMD_IMPORT, 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" + "\tbatch\n" "\texport []\n" "\timport []\n" "\tshow [[.
[.