scripts/config: backport output file option from r25230
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 15 Mar 2011 02:37:49 +0000 (02:37 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 15 Mar 2011 02:37:49 +0000 (02:37 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@26170 3c298f89-4303-0410-b956-a3cf2f4a3e73

scripts/config/conf.c

index 6589aee4515d86cfba4e339b0942979a174b61fc..0a44a2edd13618d6377719303c623086cf4c65f9 100644 (file)
@@ -508,9 +508,10 @@ int main(int ac, char **av)
 {
        int i = 1;
        const char *name;
 {
        int i = 1;
        const char *name;
+       char *output = NULL;
        struct stat tmpstat;
 
        struct stat tmpstat;
 
-       if (ac > i && av[i][0] == '-') {
+       while (ac > i && av[i][0] == '-') {
                switch (av[i++][1]) {
                case 'o':
                        input_mode = ask_new;
                switch (av[i++][1]) {
                case 'o':
                        input_mode = ask_new;
@@ -531,6 +532,9 @@ int main(int ac, char **av)
                                exit(1);
                        }
                        break;
                                exit(1);
                        }
                        break;
+               case 'w':
+                       output = av[i++];
+                       break;
                case 'n':
                        input_mode = set_no;
                        break;
                case 'n':
                        input_mode = set_no;
                        break;
@@ -601,7 +605,7 @@ int main(int ac, char **av)
                conf_cnt = 0;
                check_conf(&rootmenu);
        } while (conf_cnt);
                conf_cnt = 0;
                check_conf(&rootmenu);
        } while (conf_cnt);
-       if (conf_write(NULL)) {
+       if (conf_write(output)) {
                fprintf(stderr, _("\n*** Error during writing of the build configuration.\n\n"));
                return 1;
        }
                fprintf(stderr, _("\n*** Error during writing of the build configuration.\n\n"));
                return 1;
        }