kconfig: make kconfig MinGW friendly
[safe/jmp/linux-2.6] / scripts / kconfig / menu.c
index a8afce2..f9d0d91 100644 (file)
@@ -114,7 +114,7 @@ void menu_set_type(int type)
                sym->type = type;
                return;
        }
-       menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n",
+       menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'",
            sym->name ? sym->name : "<choice>",
            sym_type_name(sym->type), sym_type_name(type));
 }
@@ -124,15 +124,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
        struct property *prop = prop_alloc(type, current_entry->sym);
 
        prop->menu = current_entry;
-       prop->text = prompt;
        prop->expr = expr;
        prop->visible.expr = menu_check_dep(dep);
 
        if (prompt) {
+               if (isspace(*prompt)) {
+                       prop_warn(prop, "leading whitespace ignored");
+                       while (isspace(*prompt))
+                               prompt++;
+               }
                if (current_entry->prompt)
-                       menu_warn(current_entry, "prompt redefined\n");
+                       prop_warn(prop, "prompt redefined");
                current_entry->prompt = prop;
        }
+       prop->text = prompt;
 
        return prop;
 }
@@ -198,7 +203,7 @@ void sym_check_prop(struct symbol *sym)
                        else if (sym2->type == S_UNKNOWN)
                                prop_warn(prop,
                                    "'select' used by config symbol '%s' "
-                                   "refer to undefined symbol '%s'",
+                                   "refers to undefined symbol '%s'",
                                    sym->name, sym2->name);
                        else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE)
                                prop_warn(prop,
@@ -343,11 +348,10 @@ void menu_finalize(struct menu *parent)
 
        if (sym && !(sym->flags & SYMBOL_WARNED)) {
                if (sym->type == S_UNKNOWN)
-                       menu_warn(parent, "config symbol defined "
-                           "without type\n");
+                       menu_warn(parent, "config symbol defined without type");
 
                if (sym_is_choice(sym) && !parent->prompt)
-                       menu_warn(parent, "choice must have a prompt\n");
+                       menu_warn(parent, "choice must have a prompt");
 
                /* Check properties connected to this symbol */
                sym_check_prop(sym);
@@ -413,3 +417,15 @@ struct menu *menu_get_parent_menu(struct menu *menu)
        return menu;
 }
 
+bool menu_has_help(struct menu *menu)
+{
+       return menu->help != NULL;
+}
+
+const char *menu_get_help(struct menu *menu)
+{
+       if (menu->help)
+               return menu->help;
+       else
+               return "";
+}