[PATCH] kconfig: kxgettext: EOL fix
authorEgry Gabor <gaboregry@t-online.hu>
Sat, 3 Sep 2005 22:55:14 +0000 (15:55 -0700)
committerLinus Torvalds <torvalds@evo.osdl.org>
Mon, 5 Sep 2005 07:05:49 +0000 (00:05 -0700)
The end of line character doesn't exist on end of help in all case, check it
first.

Signed-off-by: Egry Gabor <gaboregry@t-online.hu>
Cc: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
scripts/kconfig/kxgettext.c

index ad1cb94..abee55c 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;
@@ -43,7 +48,7 @@ next:
                --len;
        }
 
-       if (multiline)
+       if (multiline && eol)
                bfp -= 3;
 
        *bfp++ = '"';