USB: Support for allocating USB 3.0 streams.
[safe/jmp/linux-2.6] / scripts / kconfig / kxgettext.c
index 1c88d7c..dcc3fcc 100644 (file)
@@ -14,6 +14,11 @@ static char *escape(const char* text, char *bf, int len)
 {
        char *bfp = bf;
        int multiline = strchr(text, '\n') != NULL;
+       int eol = 0;
+       int textlen = strlen(text);
+
+       if ((textlen > 0) && (text[textlen-1] == '\n'))
+               eol = 1;
 
        *bfp++ = '"';
        --len;
@@ -38,12 +43,16 @@ static char *escape(const char* text, char *bf, int len)
                        ++text;
                        goto next;
                }
+               else if (*text == '\\') {
+                       *bfp++ = '\\';
+                       len--;
+               }
                *bfp++ = *text++;
 next:
                --len;
        }
 
-       if (multiline)
+       if (multiline && eol)
                bfp -= 3;
 
        *bfp++ = '"';
@@ -157,7 +166,7 @@ static int message__add(const char *msg, char *option, char *file, int lineno)
        return rc;
 }
 
-void menu_build_message_list(struct menu *menu)
+static void menu_build_message_list(struct menu *menu)
 {
        struct menu *child;
 
@@ -165,8 +174,8 @@ void menu_build_message_list(struct menu *menu)
                     menu->file == NULL ? "Root Menu" : menu->file->name,
                     menu->lineno);
 
-       if (menu->sym != NULL && menu->sym->help != NULL)
-               message__add(menu->sym->help, menu->sym->name,
+       if (menu->sym != NULL && menu_has_help(menu))
+               message__add(menu_get_help(menu), menu->sym->name,
                             menu->file == NULL ? "Root Menu" : menu->file->name,
                             menu->lineno);
 
@@ -179,7 +188,11 @@ static void message__print_file_lineno(struct message *self)
 {
        struct file_line *fl = self->files;
 
-       printf("\n#: %s:%d", fl->file, fl->lineno);
+       putchar('\n');
+       if (self->option != NULL)
+               printf("# %s:00000\n", self->option);
+
+       printf("#: %s:%d", fl->file, fl->lineno);
        fl = fl->next;
 
        while (fl != NULL) {
@@ -187,9 +200,6 @@ static void message__print_file_lineno(struct message *self)
                fl = fl->next;
        }
 
-       if (self->option != NULL)
-               printf(", %s:00000", self->option);
-
        putchar('\n');
 }
 
@@ -201,12 +211,14 @@ static void message__print_gettext_msgid_msgstr(struct message *self)
               "msgstr \"\"\n", self->msg);
 }
 
-void menu__xgettext(void)
+static void menu__xgettext(void)
 {
        struct message *m = message__list;
 
        while (m != NULL) {
-               message__print_gettext_msgid_msgstr(m);
+               /* skip empty lines ("") */
+               if (strlen(m->msg) > sizeof("\"\""))
+                       message__print_gettext_msgid_msgstr(m);
                m = m->next;
        }
 }