X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=cli.c;h=229352f3bf2124846cbf7d4511fbd6bb409ea5d2;hp=7dece62f5556878a5f300ffddf88f576c30cec8d;hb=928edd2bff38b17dd0949fb80196275f6532b950;hpb=f7df28b4d0155c780fa46a09d2dbcf7825faebae diff --git a/cli.c b/cli.c index 7dece62..229352f 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,61 +12,535 @@ * GNU General Public License for more details. */ #include +#include #include +#include #include "uci.h" +#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, + CMD_SET, + 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(int argc, char **argv) +static void uci_usage(void) { fprintf(stderr, - "Usage: %s [options] [arguments]\n\n" + "Usage: %s [] []\n\n" "Commands:\n" - "\tshow [[.
[.