merge from upstream for systems that dont integrate libintl into their C library:
[oweals/busybox.git] / scripts / kconfig / confdata.c
index d38bbba93aaf797f9006aecfe6fc02c4222c5ee8..4837f61d96bad3d480955e18e46e8e34b16019d9 100644 (file)
@@ -25,10 +25,7 @@ const char conf_def_filename[] = ".config";
 const char conf_defname[] = "scripts/defconfig";
 
 const char *conf_confnames[] = {
-       ".config",
-       "/lib/modules/$UNAME_RELEASE/.config",
-       "/etc/kernel-config",
-       "/boot/config-$UNAME_RELEASE",
+       conf_def_filename,
        conf_defname,
        NULL,
 };
@@ -225,7 +222,8 @@ int conf_read_simple(const char *name)
                                        sym->user.val = strdup(p);
                                        sym->flags &= ~SYMBOL_NEW;
                                } else {
-                                       conf_warning("symbol value '%s' invalid for %s", p, sym->name);
+                                       if (p[0]) /* bbox */
+                                               conf_warning("symbol value '%s' invalid for %s", p, sym->name);
                                        continue;
                                }
                                break;
@@ -385,7 +383,7 @@ int conf_write(const char *name)
 
        fprintf(out, _("#\n"
                       "# Automatically generated make config: don't edit\n"
-                      "# Linux kernel version: %s\n"
+                      "# Busybox version: %s\n"
                       "%s%s"
                       "#\n"),
                     sym_get_string_value(sym),
@@ -395,15 +393,24 @@ int conf_write(const char *name)
                char buf[sizeof("#define AUTOCONF_TIMESTAMP "
                                "\"YYYY-MM-DD HH:MM:SS some_timezone\"\n")];
                buf[0] = '\0';
-               if (use_timestamp)
-                       strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP "
-                               "\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now));
+               if (use_timestamp) {
+                       size_t ret = \
+                               strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP "
+                                       "\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now));
+                       /* if user has Factory timezone or some other odd install, the
+                        * %Z above will overflow the string leaving us with undefined
+                        * results ... so let's try again without the timezone.
+                        */
+                       if (ret == 0)
+                               strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP "
+                                       "\"%Y-%m-%d %H:%M:%S\"\n", localtime(&now));
+               }
                fprintf(out_h, "/*\n"
                               " * Automatically generated C config: don't edit\n"
-                              " * Linux kernel version: %s\n"
+                              " * Busybox version: %s\n"
                               " */\n"
                               "%s"
-                              "#define AUTOCONF_INCLUDED\n",
+                              "\n",
                               sym_get_string_value(sym),
                               buf);
        }