Commit | Line | Data |
---|---|---|
8584be19 | 1 | #ifndef lint |
27b31336 | 2 | static char *sccsid = "@(#)wwmisc.c 3.2 83/09/02"; |
8584be19 EW |
3 | #endif |
4 | ||
5 | #include "ww.h" | |
6 | ||
27b31336 EW |
7 | /* |
8 | * Sufficient but necessary test for total visibility. | |
9 | */ | |
10 | wwvisible(w) | |
11 | register struct ww *w; | |
12 | { | |
13 | register i; | |
14 | register nvis = 0; | |
15 | ||
16 | for (i = 0; i < w->ww_w.nr; i++) | |
17 | nvis += w->ww_nvis[i]; | |
18 | if (w->ww_hascursor && wwsmap[wwcurrow(w)][wwcurcol(w)] == w->ww_index) | |
19 | nvis++; | |
20 | return nvis == w->ww_w.nr * w->ww_w.nc; | |
21 | } | |
22 | ||
2ea355ad EW |
23 | char * |
24 | unctrl(c) | |
25 | register char c; | |
26 | { | |
27 | static char buf[5]; | |
28 | register char *p = buf; | |
29 | ||
30 | if (c == DEL) { | |
31 | *p++ = '^'; | |
32 | *p++ = '?'; | |
33 | } else if (c < ' ') { | |
34 | *p++ = '^'; | |
35 | *p++ = c + '@'; | |
36 | } else if (c > DEL) { | |
37 | *p++ = '\\'; | |
38 | *p++ = (c >> 6 & 3) + '0'; | |
39 | *p++ = (c >> 3 & 7) + '0'; | |
40 | *p++ = (c & 7) + '0'; | |
41 | } else | |
42 | *p++ = c; | |
43 | *p = 0; | |
44 | return buf; | |
45 | } |