remove trailing spaces in top batch mode

Signed-off-by: Jan Görig <jgorig@redhat.com>
This commit is contained in:
Jim Warner 2011-06-01 13:58:06 +02:00 committed by Jan Görig
parent c2dcbef482
commit 91edf89810

7
top.h
View File

@ -401,9 +401,10 @@ typedef struct WIN_t {
. assumed to represent a complete screen ROW . assumed to represent a complete screen ROW
. subject to optimization, thus MAY be discarded */ . subject to optimization, thus MAY be discarded */
#define PUFF(fmt,arg...) do { \ #define PUFF(fmt,arg...) do { \
char _str[ROWMAXSIZ]; \ char _str[ROWMAXSIZ], *_eol; \
snprintf(_str, sizeof(_str), fmt, ## arg); \ _eol = _str + snprintf(_str, sizeof(_str), fmt, ## arg); \
if (Batch) putp(_str); \ if (Batch) { \
while (*(--_eol) == ' '); *(++_eol) = '\0'; putp(_str); } \
else { \ else { \
char *_ptr = &Pseudo_screen[Pseudo_row * ROWMAXSIZ]; \ char *_ptr = &Pseudo_screen[Pseudo_row * ROWMAXSIZ]; \
if (Pseudo_row + 1 < Screen_rows) ++Pseudo_row; \ if (Pseudo_row + 1 < Screen_rows) ++Pseudo_row; \