mapnl option to window
[unix-history] / usr / src / usr.bin / window / cmd6.c
index e69de29..bc8824e 100644 (file)
@@ -0,0 +1,74 @@
+#ifndef lint
+static char sccsid[] = "@(#)cmd6.c     3.12 %G%";
+#endif
+
+#include "defs.h"
+#include "string.h"
+#include "char.h"
+
+/*
+ * Debugging commands.
+ */
+
+c_debug()
+{
+       register struct ww *w;
+
+       if (!terse)
+               wwputs("[m(smap) n(ns) o(os) s(string) v(nvis) w(win)]? ", cmdwin);
+       wwcurtowin(cmdwin);
+       while (wwpeekc() < 0)
+               wwiomux();
+       if (!terse)
+               wwputc('\n', cmdwin);
+       switch (wwgetc()) {
+       case 'm':
+               wwdumpsmap();
+               break;
+       case 'n':
+               wwdumpns();
+               break;
+       case 'o':
+               wwdumpos();
+               break;
+       case 's':
+               debug_str();
+               break;
+       case 'v':
+               if ((w = getwin()) != 0)
+                       wwdumpnvis(w);
+               break;
+       case 'w':
+               if ((w = getwin()) != 0)
+                       wwdumpwin(w);
+               break;
+       default:
+               wwbell();
+       }
+}
+
+#ifdef STR_DEBUG
+debug_str()
+{
+       register struct ww *w;
+       struct string *s;
+
+       if ((w = openiwin(wwnrow - 3, "Allocated Strings")) == 0) {
+               error("Can't open string window: %s.", wwerror());
+               return;
+       }
+       for (s = str_head.s_forw; s != &str_head; s = s->s_forw) {
+               if (more(w, 0) == 2)
+                       goto out;
+               wwprintf(w, "(0x%x)\t\"%s\"\n", s->s_data, s->s_data);
+       }
+       waitnl(w);
+out:
+       closeiwin(w);
+}
+#else
+debug_str()
+{
+       error("No string debugging.");
+}
+#endif