X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=cli.c;h=cd829384a80a1a65309f38051ac9fe3eb86efdb0;hb=3bff697cca125a6a4147e3bd1c469b36504e8237;hp=e17acb5fe3c18d277a61b09426dd7533c00a38da;hpb=4aa3fd762e2190a4e418581cf24446484d0b7df5;p=project%2Fuci.git diff --git a/cli.c b/cli.c index e17acb5..cd82938 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,24 +12,119 @@ * GNU General Public License for more details. */ #include +#include #include +#include #include "uci.h" -static struct uci_context *ctx; +#define MAX_ARGS 4 /* max command line arguments for batch mode */ + +static const char *delimiter = " "; +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 void uci_usage(int argc, char **argv) +static struct uci_context *ctx; +enum { + /* section cmds */ + CMD_GET, + CMD_SET, + CMD_ADD_LIST, + CMD_DEL, + CMD_RENAME, + CMD_REVERT, + /* package cmds */ + CMD_SHOW, + CMD_CHANGES, + CMD_EXPORT, + CMD_COMMIT, + /* other cmds */ + CMD_ADD, + CMD_IMPORT, + CMD_HELP, +}; + +static int uci_cmd(int argc, char **argv); + +static void uci_usage(void) { fprintf(stderr, "Usage: %s [] []\n\n" "Commands:\n" - "\texport []\n" - "\tshow [[.
[.