1 /* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Edward Wang at The University of California, Berkeley. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11 #ifndef lint 12 static char sccsid[] = "@(#)cmd6.c 8.1 (Berkeley) 06/06/93"; 13 #endif /* not lint */ 14 15 #include "defs.h" 16 #include "string.h" 17 #include "char.h" 18 19 /* 20 * Debugging commands. 21 */ 22 23 c_debug() 24 { 25 register struct ww *w; 26 27 if (!terse) 28 wwputs("[m(smap) n(ns) o(os) s(string) v(nvis) w(win)]? ", cmdwin); 29 wwcurtowin(cmdwin); 30 while (wwpeekc() < 0) 31 wwiomux(); 32 if (!terse) 33 wwputc('\n', cmdwin); 34 switch (wwgetc()) { 35 case 'm': 36 wwdumpsmap(); 37 break; 38 case 'n': 39 wwdumpns(); 40 break; 41 case 'o': 42 wwdumpos(); 43 break; 44 case 's': 45 debug_str(); 46 break; 47 case 'v': 48 if ((w = getwin()) != 0) 49 wwdumpnvis(w); 50 break; 51 case 'w': 52 if ((w = getwin()) != 0) 53 wwdumpwin(w); 54 break; 55 default: 56 wwbell(); 57 } 58 } 59 60 #ifdef STR_DEBUG 61 debug_str() 62 { 63 register struct ww *w; 64 struct string *s; 65 66 if ((w = openiwin(wwnrow - 3, "Allocated Strings")) == 0) { 67 error("Can't open string window: %s.", wwerror()); 68 return; 69 } 70 for (s = str_head.s_forw; s != &str_head; s = s->s_forw) { 71 if (more(w, 0) == 2) 72 goto out; 73 wwprintf(w, "(0x%x)\t\"%s\"\n", s->s_data, s->s_data); 74 } 75 waitnl(w); 76 out: 77 closeiwin(w); 78 } 79 #else 80 debug_str() 81 { 82 error("No string debugging."); 83 } 84 #endif 85