ca-certificates: update to version 20190110
[openwrt/staging/dedeckeh.git] / scripts / config / conf.c
index 16e5c4378718c37f2e9ad14f97673c74ed00b4c6..cf20e0a2164b760183497ad7763d8ce1c1f02b49 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <locale.h>
 #include <ctype.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -41,7 +42,7 @@ static int tty_stdio;
 static int valid_stdin = 1;
 static int sync_kconfig;
 static int conf_cnt;
-static char line[128];
+static char line[PATH_MAX];
 static struct menu *rootEntry;
 
 static void print_help(struct menu *menu)
@@ -74,9 +75,9 @@ static void strip(char *str)
 static void check_stdin(void)
 {
        if (!valid_stdin) {
-               printf(_("aborted!\n\n"));
-               printf(_("Console input/output is redirected. "));
-               printf(_("Run 'make oldconfig' to update configuration.\n\n"));
+               printf("%s",_("aborted!\n\n"));
+               printf("%s",_("Console input/output is redirected. "));
+               printf("%s",_("Run 'make oldconfig' to update configuration.\n\n"));
                exit(1);
        }
 }
@@ -86,7 +87,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
        enum symbol_type type = sym_get_type(sym);
 
        if (!sym_has_value(sym))
-               printf(_("(NEW) "));
+               printf("%s",_("(NEW) "));
 
        line[0] = '\n';
        line[1] = 0;
@@ -109,7 +110,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
                /* fall through */
        case oldaskconfig:
                fflush(stdout);
-               xfgets(line, 128, stdin);
+               xfgets(line, sizeof(line), stdin);
                if (!tty_stdio)
                        printf("\n");
                return 1;
@@ -287,7 +288,7 @@ static int conf_choice(struct menu *menu)
                        if (child->sym->name)
                                printf(" (%s)", child->sym->name);
                        if (!sym_has_value(child->sym))
-                               printf(_(" (NEW)"));
+                               printf("%s",_(" (NEW)"));
                        printf("\n");
                }
                printf(_("%*schoice"), indent - 1, "");
@@ -311,7 +312,7 @@ static int conf_choice(struct menu *menu)
                        /* fall through */
                case oldaskconfig:
                        fflush(stdout);
-                       xfgets(line, 128, stdin);
+                       xfgets(line, sizeof(line), stdin);
                        strip(line);
                        if (line[0] == '?') {
                                print_help(menu);
@@ -435,7 +436,7 @@ static void check_conf(struct menu *menu)
                                }
                        } else if (input_mode != olddefconfig) {
                                if (!conf_cnt++)
-                                       printf(_("*\n* Restart config...\n*\n"));
+                                       printf("%s",_("*\n* Restart config...\n*\n"));
                                rootEntry = menu_get_parent_menu(menu);
                                conf(rootEntry);
                        }
@@ -471,7 +472,7 @@ static struct option long_opts[] = {
 static void conf_usage(const char *progname)
 {
 
-       printf("Usage: %s [option] <kconfig-file>\n", progname);
+       printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
        printf("[option] is _one_ of the following:\n");
        printf("  --listnewconfig         List new options\n");
        printf("  --oldaskconfig          Start a new configuration using a line-oriented program\n");
@@ -502,7 +503,11 @@ int main(int ac, char **av)
 
        tty_stdio = isatty(0) && isatty(1) && isatty(2);
 
-       while ((opt = getopt_long(ac, av, "r:w:", long_opts, NULL)) != -1) {
+       while ((opt = getopt_long(ac, av, "r:w:s", long_opts, NULL)) != -1) {
+               if (opt == 's') {
+                       conf_set_message_callback(NULL);
+                       continue;
+               }
                switch (opt) {
                case silentoldconfig:
                        sync_kconfig = 1;