--- procps-3.2.5/top.h.pseudo 2005-03-17 13:32:05.305659080 +0100 +++ procps-3.2.5/top.h 2005-03-17 13:34:04.837487480 +0100 @@ -149,8 +149,13 @@ int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \ if (Batch) _ptr = _str; \ else { \ - _ptr = &Pseudo_scrn[Pseudo_row++ * Pseudo_cols]; \ - if (memcmp(_ptr, _str, _len)) { \ + int _rest; \ + _ptr = &Pseudo_scrn[Pseudo_row * Pseudo_cols]; \ + _rest = Pseudo_size-(_ptr-Pseudo_scrn); \ + Pseudo_row = (Pseudo_row+1) % Screen_rows; \ + if (_rest < _len) \ + _len = _rest; \ + if (memcmp(_ptr, _str, _len)) { \ memcpy(_ptr, _str, _len); \ } else { \ _ptr = "\n"; \