Commit | Line | Data |
---|---|---|
f176f953 | 1 | #ifndef lint |
60de5df9 | 2 | static char sccsid[] = "@(#)cmd6.c 3.13 %G%"; |
f176f953 EW |
3 | #endif |
4 | ||
60de5df9 EW |
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 | ||
f176f953 | 11 | #include "defs.h" |
36d54c8e | 12 | #include "string.h" |
0e64e422 | 13 | #include "char.h" |
f176f953 EW |
14 | |
15 | /* | |
16 | * Debugging commands. | |
17 | */ | |
18 | ||
19 | c_debug() | |
20 | { | |
21 | register struct ww *w; | |
22 | ||
23 | if (!terse) | |
b1189050 | 24 | wwputs("[m(smap) n(ns) o(os) s(string) v(nvis) w(win)]? ", cmdwin); |
f176f953 | 25 | wwcurtowin(cmdwin); |
8fa6d94c EW |
26 | while (wwpeekc() < 0) |
27 | wwiomux(); | |
f176f953 | 28 | if (!terse) |
bf3b96e9 | 29 | wwputc('\n', cmdwin); |
8fa6d94c | 30 | switch (wwgetc()) { |
f176f953 EW |
31 | case 'm': |
32 | wwdumpsmap(); | |
33 | break; | |
34 | case 'n': | |
35 | wwdumpns(); | |
36 | break; | |
37 | case 'o': | |
38 | wwdumpos(); | |
39 | break; | |
36d54c8e EW |
40 | case 's': |
41 | debug_str(); | |
42 | break; | |
f176f953 EW |
43 | case 'v': |
44 | if ((w = getwin()) != 0) | |
45 | wwdumpnvis(w); | |
46 | break; | |
f176f953 EW |
47 | case 'w': |
48 | if ((w = getwin()) != 0) | |
49 | wwdumpwin(w); | |
50 | break; | |
51 | default: | |
7ecf4dca | 52 | wwbell(); |
f176f953 EW |
53 | } |
54 | } | |
36d54c8e EW |
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 | } | |
74e9bfa3 | 66 | for (s = str_head.s_forw; s != &str_head; s = s->s_forw) { |
4a972f7c EW |
67 | if (more(w, 0) == 2) |
68 | goto out; | |
b1189050 | 69 | wwprintf(w, "(0x%x)\t\"%s\"\n", s->s_data, s->s_data); |
74e9bfa3 | 70 | } |
36d54c8e | 71 | waitnl(w); |
4a972f7c | 72 | out: |
36d54c8e EW |
73 | closeiwin(w); |
74 | } | |
75 | #else | |
76 | debug_str() | |
77 | { | |
78 | error("No string debugging."); | |
79 | } | |
80 | #endif |