1 #ifndef lint 2 static char *sccsid = "@(#)wwmisc.c 2.1 83/07/30"; 3 #endif 4 5 #include "ww.h" 6 7 struct ww *wwhead = 0; 8 struct ww *curwin = 0; 9 10 wwsetcurwin(wp) 11 register struct ww *wp; 12 { 13 curwin = wp; 14 Wfront(wp->ww_win); 15 } 16 17 wwhaschildren() 18 { 19 register struct ww *wp; 20 21 for (wp = wwhead; wp; wp = wp->ww_next) 22 if (wp->ww_state == WW_HASPROC) 23 return 1; 24 return 0; 25 } 26 27 struct ww * 28 wwfind(id) 29 register id; 30 { 31 register struct ww *w; 32 33 for (w = wwhead; w && w->ww_ident != id; w = w->ww_next) 34 ; 35 return w; 36 } 37 38 char * 39 unctrl(c) 40 register char c; 41 { 42 static char buf[5]; 43 register char *p = buf; 44 45 if (c == DEL) { 46 *p++ = '^'; 47 *p++ = '?'; 48 } else if (c < ' ') { 49 *p++ = '^'; 50 *p++ = c + '@'; 51 } else if (c > DEL) { 52 *p++ = '\\'; 53 *p++ = (c >> 6 & 3) + '0'; 54 *p++ = (c >> 3 & 7) + '0'; 55 *p++ = (c & 7) + '0'; 56 } else 57 *p++ = c; 58 *p = 0; 59 return buf; 60 } 61