debug
authorPierre Habouzit <madcoder@debian.org>
Sat, 10 Nov 2007 23:34:59 +0000 (00:34 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sat, 10 Nov 2007 23:34:59 +0000 (00:34 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
madtty/madtty.c

index 8994454..af12870 100644 (file)
@@ -612,6 +612,17 @@ static void try_interpret_escape_seq(madtty_t *t)
 
     if (t->elen + 1 >= (int)sizeof(t->ebuf)) {
 cancel:
+#ifndef NDEBUG
+        fprintf(stderr, "cancelled: \\033");
+        for (int i = 0; i < (int)t->elen; i++) {
+            if (isprint(t->ebuf[i])) {
+                fputc(t->ebuf[i], stderr);
+            } else {
+                fprintf(stderr, "\\%03o", t->ebuf[i]);
+            }
+        }
+        fputc('\n', stderr);
+#endif
         cancel_escape_sequence(t);
     }
 }