allow the cli to override the confdir
authorFelix Fietkau <nbd@openwrt.org>
Fri, 6 Jun 2008 18:23:52 +0000 (20:23 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 6 Jun 2008 18:23:52 +0000 (20:23 +0200)
cli.c

diff --git a/cli.c b/cli.c
index 02a34c0d6e40e955aa95233f2e11f2587b2792c3..8227987333d7848727a3cc4abeaa5049e3b56886 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -68,6 +68,7 @@ static void uci_usage(void)
                "\trevert     <config>[.<section>[.<option>]]\n"
                "\n"
                "Options:\n"
+               "\t-c <path>  set the search path for config files (default: /etc/config)\n"
                "\t-f <file>  use <file> as input instead of stdin\n"
                "\t-m         when importing, merge data into an existing package\n"
                "\t-n         name unnamed sections on export (default)\n"
@@ -478,8 +479,11 @@ int main(int argc, char **argv)
                return 1;
        }
 
-       while((c = getopt(argc, argv, "f:mnNp:P:sSq")) != -1) {
+       while((c = getopt(argc, argv, "c:f:mnNp:P:sSq")) != -1) {
                switch(c) {
+                       case 'c':
+                               uci_set_confdir(ctx, optarg);
+                               break;
                        case 'f':
                                input = fopen(optarg, "r");
                                if (!input) {