Commit | Line | Data |
---|---|---|
60de5df9 | 1 | /* |
46e9ea25 KB |
2 | * Copyright (c) 1983 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
3dd3a9e5 KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Edward Wang at The University of California, Berkeley. | |
7 | * | |
87f529ec | 8 | * %sccs.include.redist.c% |
60de5df9 EW |
9 | */ |
10 | ||
46e9ea25 | 11 | #ifndef lint |
3dd3a9e5 | 12 | static char sccsid[] = "@(#)cmd6.c 3.17 (Berkeley) %G%"; |
46e9ea25 KB |
13 | #endif /* not lint */ |
14 | ||
f176f953 | 15 | #include "defs.h" |
36d54c8e | 16 | #include "string.h" |
0e64e422 | 17 | #include "char.h" |
f176f953 EW |
18 | |
19 | /* | |
20 | * Debugging commands. | |
21 | */ | |
22 | ||
23 | c_debug() | |
24 | { | |
25 | register struct ww *w; | |
26 | ||
27 | if (!terse) | |
b1189050 | 28 | wwputs("[m(smap) n(ns) o(os) s(string) v(nvis) w(win)]? ", cmdwin); |
f176f953 | 29 | wwcurtowin(cmdwin); |
8fa6d94c EW |
30 | while (wwpeekc() < 0) |
31 | wwiomux(); | |
f176f953 | 32 | if (!terse) |
bf3b96e9 | 33 | wwputc('\n', cmdwin); |
8fa6d94c | 34 | switch (wwgetc()) { |
f176f953 EW |
35 | case 'm': |
36 | wwdumpsmap(); | |
37 | break; | |
38 | case 'n': | |
39 | wwdumpns(); | |
40 | break; | |
41 | case 'o': | |
42 | wwdumpos(); | |
43 | break; | |
36d54c8e EW |
44 | case 's': |
45 | debug_str(); | |
46 | break; | |
f176f953 EW |
47 | case 'v': |
48 | if ((w = getwin()) != 0) | |
49 | wwdumpnvis(w); | |
50 | break; | |
f176f953 EW |
51 | case 'w': |
52 | if ((w = getwin()) != 0) | |
53 | wwdumpwin(w); | |
54 | break; | |
55 | default: | |
7ecf4dca | 56 | wwbell(); |
f176f953 EW |
57 | } |
58 | } | |
36d54c8e EW |
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 | } | |
74e9bfa3 | 70 | for (s = str_head.s_forw; s != &str_head; s = s->s_forw) { |
4a972f7c EW |
71 | if (more(w, 0) == 2) |
72 | goto out; | |
b1189050 | 73 | wwprintf(w, "(0x%x)\t\"%s\"\n", s->s_data, s->s_data); |
74e9bfa3 | 74 | } |
36d54c8e | 75 | waitnl(w); |
4a972f7c | 76 | out: |
36d54c8e EW |
77 | closeiwin(w); |
78 | } | |
79 | #else | |
80 | debug_str() | |
81 | { | |
82 | error("No string debugging."); | |
83 | } | |
84 | #endif |