1 /* this was written to test the term.c code, which was 2 found on the web for use in XLisp to enable ^C and other 3 character-by-character handling 4 */ 5 6 #include "term.h" 7 #include <signal.h> 8 ctcinit()9void ctcinit() 10 { 11 signal(SIGINT, term_exit); 12 } 13 14 main()15main() 16 { 17 int c; 18 int count = 0; 19 term_init(); 20 term_character(); 21 while ((c = term_testchar()) == -2) count++; 22 printf("got %c after %d\n", c, count); 23 while ((c = getchar()) != 'x') { 24 printf("got '%c' = %x\n", c, c); 25 } 26 term_exit(); 27 } 28 29