Commit | Line | Data |
---|---|---|
6e1c93d0 DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6 | ||
7 | #ifndef lint | |
8 | static char sccsid[] = "@(#)erase.c 5.1 (Berkeley) %G%"; | |
9 | #endif not lint | |
10 | ||
cc1a8c38 KA |
11 | # include "curses.ext" |
12 | ||
13 | /* | |
14 | * This routine erases everything on the window. | |
15 | * | |
cc1a8c38 KA |
16 | */ |
17 | werase(win) | |
18 | reg WINDOW *win; { | |
19 | ||
20 | reg int y; | |
21 | reg char *sp, *end, *start, *maxx; | |
22 | reg int minx; | |
23 | ||
c4a44a4e KA |
24 | # ifdef DEBUG |
25 | fprintf(outf, "WERASE(%0.2o)\n", win); | |
26 | # endif | |
cc1a8c38 KA |
27 | for (y = 0; y < win->_maxy; y++) { |
28 | minx = _NOCHANGE; | |
29 | start = win->_y[y]; | |
30 | end = &start[win->_maxx]; | |
31 | for (sp = start; sp < end; sp++) | |
32 | if (*sp != ' ') { | |
33 | maxx = sp; | |
34 | if (minx == _NOCHANGE) | |
35 | minx = sp - start; | |
36 | *sp = ' '; | |
37 | } | |
f06658c3 JB |
38 | if (minx != _NOCHANGE) |
39 | touchline(win, y, minx, maxx - win->_y[y]); | |
cc1a8c38 KA |
40 | } |
41 | win->_curx = win->_cury = 0; | |
42 | } |