used by update_topl(); also by tty_putstr() */
| 167 | |
| 168 | /* used by update_topl(); also by tty_putstr() */ |
| 169 | void |
| 170 | remember_topl(void) |
| 171 | { |
| 172 | struct WinDesc *cw = wins[WIN_MESSAGE]; |
| 173 | int idx = cw->maxrow; |
| 174 | unsigned len = strlen(gt.toplines) + 1; |
| 175 | |
| 176 | if ((cw->flags & WIN_LOCKHISTORY) || !*gt.toplines) |
| 177 | return; |
| 178 | |
| 179 | if (len > (unsigned) cw->datlen[idx]) { |
| 180 | if (cw->data[idx]) |
| 181 | free(cw->data[idx]); |
| 182 | len += (8 - (len & 7)); /* pad up to next multiple of 8 */ |
| 183 | cw->data[idx] = (char *) alloc(len); |
| 184 | cw->datlen[idx] = (short) len; |
| 185 | } |
| 186 | Strcpy(cw->data[idx], gt.toplines); |
| 187 | if (!program_state.in_checkpoint) { |
| 188 | *gt.toplines = '\0'; |
| 189 | cw->maxcol = cw->maxrow = (idx + 1) % cw->rows; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | void |
| 194 | addtopl(const char *s) |
no test coverage detected