X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=cli.c;h=e05f5d4db06e7c615757a1f321fa326f13e25a97;hp=4e0c5b715d9bbebfc7f8d18de6cfc730a19eaa93;hb=24c59ffa00d5ba40483a1b0c2bce5e5af2b38a3a;hpb=e6279f87129e65c469a29d606a4b6afd7b7207b8 diff --git a/cli.c b/cli.c index 4e0c5b7..e05f5d4 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 @@ -12,21 +13,75 @@ */ #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_EXPORT, + CMD_COMMIT, + /* other cmds */ + 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 [] []\n\n" "Commands:\n" - "\tshow [[.
[.