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