summaryrefslogtreecommitdiffstats
path: root/konsole/tests/audit.c
diff options
context:
space:
mode:
Diffstat (limited to 'konsole/tests/audit.c')
-rw-r--r--konsole/tests/audit.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/konsole/tests/audit.c b/konsole/tests/audit.c
new file mode 100644
index 000000000..7a98e9b30
--- /dev/null
+++ b/konsole/tests/audit.c
@@ -0,0 +1,53 @@
+/*
+
+ This is a tiny test program that can be used to track down
+ strange effects of the emulation.
+
+ Make:
+
+ - gcc -o audit audit.c
+
+ Usage:
+
+ - In TEShell.C let syslog be stdout.
+ - konsole > ttt
+ - produce the effect in question.
+ - run this program.
+ pressing any key advances the audit
+ ^C terminates.
+
+ You need to make sure that the size of the screen matches
+ the one being debugged.
+
+*/
+
+
+#include <stdio.h>
+#include <termios.h>
+#include <unistd.h>
+
+struct termios save;
+struct termios curr;
+
+#define HERE fprintf(stderr,"%s(%d): here.\n",__FILE__,__LINE__)
+
+main()
+{ int cc;
+ FILE* sysin = fopen("ttt","r");
+ tcgetattr(0, &save);
+ tcgetattr(0, &curr);
+ cfmakeraw(&curr);
+ tcsetattr(0, TCSANOW, &curr);
+ cc = fgetc(sysin);
+ while( cc > 0 )
+ { int tmp;
+ while (cc > 0)
+ {
+ fputc(cc,stdout); cc = fgetc(sysin);
+ if (cc == 0x1b) break;
+ }
+ tmp = fgetc(stdin);
+ if (tmp == 3) break;
+ }
+ tcsetattr(0, TCSANOW, &save);
+}