00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "defs.h"
00022 #include <termios.h>
00023 #include "tc_setraw.h"
00024
00025 int main(void)
00026 {
00027 int c;
00028
00029 #if 0
00030 system("stty sane");
00031
00032 setbuf(stdout, NULL);
00033 printf("Initial attributes:\n");
00034 system("stty | fold -s -w 60");
00035 printf("\r\nRaw attributes:\n");
00036 tc_setraw();
00037 system("stty | fold -s -w 60");
00038 tc_restore();
00039 printf("\r\nRestored attributes:\n");
00040 system("stty | fold -s -w 60");
00041
00042 system("stty sane");
00043 printf("\r\n");
00044 #else
00045
00046 setbuf(stdout, NULL);
00047 while (true) {
00048 c = tc_keystroke();
00049 putchar(c);
00050 if (c == 5) {
00051 ec_false( tc_restore() )
00052 printf("\nExiting...\n");
00053 exit(EXIT_SUCCESS);
00054 }
00055 }
00056
00057 #endif
00058 exit(EXIT_SUCCESS);
00059
00060 EC_CLEANUP_BGN
00061 exit(EXIT_FAILURE);
00062 EC_CLEANUP_END
00063 }