From ba84e71be3858f3a8116e8bf2e9cdcc26fb06889 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 3 Aug 2010 13:09:01 +0200 Subject: [PATCH] remove space after \n in whiptail texts (#620083) --- whiptail.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/whiptail.c b/whiptail.c index fcef340..09eca15 100644 --- a/whiptail.c +++ b/whiptail.c @@ -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'; } /* -- 2.47.2