X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=cli.c;h=9bdd5532b808dbecde909ee1e2b216783797626c;hp=93517bf392b26a54b25f3f814eefa15ed7140278;hb=12bdbcd95d42509f3b9f06bc7e811c1781635417;hpb=09a2be57d769a9b0f80e5aff75ec8bc6acae8e9a diff --git a/cli.c b/cli.c index 93517bf..9bdd553 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,36 +12,79 @@ * 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, CMD_SET, - CMD_DEL + CMD_DEL, + CMD_RENAME, + CMD_REVERT, + /* package cmds */ + 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 [[.
[.