Commit | Line | Data |
---|---|---|
60de5df9 | 1 | /* |
46e9ea25 KB |
2 | * Copyright (c) 1983 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
5e8b0e60 KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
60de5df9 EW |
16 | */ |
17 | ||
46e9ea25 | 18 | #ifndef lint |
5e8b0e60 | 19 | static char sccsid[] = "@(#)cmd6.c 3.15 (Berkeley) %G%"; |
46e9ea25 KB |
20 | #endif /* not lint */ |
21 | ||
f176f953 | 22 | #include "defs.h" |
36d54c8e | 23 | #include "string.h" |
0e64e422 | 24 | #include "char.h" |
f176f953 EW |
25 | |
26 | /* | |
27 | * Debugging commands. | |
28 | */ | |
29 | ||
30 | c_debug() | |
31 | { | |
32 | register struct ww *w; | |
33 | ||
34 | if (!terse) | |
b1189050 | 35 | wwputs("[m(smap) n(ns) o(os) s(string) v(nvis) w(win)]? ", cmdwin); |
f176f953 | 36 | wwcurtowin(cmdwin); |
8fa6d94c EW |
37 | while (wwpeekc() < 0) |
38 | wwiomux(); | |
f176f953 | 39 | if (!terse) |
bf3b96e9 | 40 | wwputc('\n', cmdwin); |
8fa6d94c | 41 | switch (wwgetc()) { |
f176f953 EW |
42 | case 'm': |
43 | wwdumpsmap(); | |
44 | break; | |
45 | case 'n': | |
46 | wwdumpns(); | |
47 | break; | |
48 | case 'o': | |
49 | wwdumpos(); | |
50 | break; | |
36d54c8e EW |
51 | case 's': |
52 | debug_str(); | |
53 | break; | |
f176f953 EW |
54 | case 'v': |
55 | if ((w = getwin()) != 0) | |
56 | wwdumpnvis(w); | |
57 | break; | |
f176f953 EW |
58 | case 'w': |
59 | if ((w = getwin()) != 0) | |
60 | wwdumpwin(w); | |
61 | break; | |
62 | default: | |
7ecf4dca | 63 | wwbell(); |
f176f953 EW |
64 | } |
65 | } | |
36d54c8e EW |
66 | |
67 | #ifdef STR_DEBUG | |
68 | debug_str() | |
69 | { | |
70 | register struct ww *w; | |
71 | struct string *s; | |
72 | ||
73 | if ((w = openiwin(wwnrow - 3, "Allocated Strings")) == 0) { | |
74 | error("Can't open string window: %s.", wwerror()); | |
75 | return; | |
76 | } | |
74e9bfa3 | 77 | for (s = str_head.s_forw; s != &str_head; s = s->s_forw) { |
4a972f7c EW |
78 | if (more(w, 0) == 2) |
79 | goto out; | |
b1189050 | 80 | wwprintf(w, "(0x%x)\t\"%s\"\n", s->s_data, s->s_data); |
74e9bfa3 | 81 | } |
36d54c8e | 82 | waitnl(w); |
4a972f7c | 83 | out: |
36d54c8e EW |
84 | closeiwin(w); |
85 | } | |
86 | #else | |
87 | debug_str() | |
88 | { | |
89 | error("No string debugging."); | |
90 | } | |
91 | #endif |