X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=cli.c;h=8227987333d7848727a3cc4abeaa5049e3b56886;hp=45a105a715320de7a2052a4a098b6532890887a9;hb=1879c8f32327177f5c0ca02c9bf9923c55d9b8b0;hpb=2b4872345ab2b49b521f2d7a70a8ed91dbcf7732 diff --git a/cli.c b/cli.c index 45a105a..8227987 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,15 +12,21 @@ * 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_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; @@ -29,26 +36,39 @@ enum { CMD_SET, CMD_DEL, CMD_RENAME, + CMD_REVERT, /* package cmds */ CMD_SHOW, - CMD_IMPORT, + CMD_CHANGES, CMD_EXPORT, CMD_COMMIT, + /* other cmds */ + CMD_ADD, + 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" + "\tchanges []\n" + "\tcommit []\n" + "\tadd \n" "\tshow [[.
[.