From: Miroslav Lichvar Date: Tue, 3 Aug 2010 11:09:01 +0000 (+0200) Subject: remove space after \n in whiptail texts (#620083) X-Git-Tag: r0-52-12~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba84e71be3858f3a8116e8bf2e9cdcc26fb06889;p=thirdparty%2Fnewt.git remove space after \n in whiptail texts (#620083) --- 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'; } /*