]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
remove space after \n in whiptail texts (#620083)
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 3 Aug 2010 11:09:01 +0000 (13:09 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 3 Aug 2010 11:09:01 +0000 (13:09 +0200)
whiptail.c

index fcef340573c2b29a298f21cae3c7567ea2874217..09eca152978f258f948f8ac005d44ec2816bf03b 100644 (file)
@@ -129,15 +129,15 @@ static const char * lineWidth(int * width, const char * line, int *chrs)
  */
 void cleanNewlines (char *text)
 {
-       char *p = text;
-       while (*p) {
-               if ((*p == '\\') && (*(p+1) == 'n')) {
-                       *p = '\n';
-                       *(p+1) = ' ';
-               } else  {
-                       p++;
-               }
-       }
+    char *p, *q;
+
+    for (p = q = text; *p; p++, q++)
+        if (*p == '\\' && p[1] == 'n') {
+            p++;
+            *q = '\n';
+        } else
+            *q = *p;
+    *q = '\0';
 }
 
 /*