File: termtest.c

package info (click to toggle)
audacity 2.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 86,844 kB
  • sloc: ansic: 225,005; cpp: 221,240; sh: 27,327; python: 16,896; makefile: 8,186; lisp: 8,002; perl: 317; xml: 307; sed: 16
file content (28 lines) | stat: -rw-r--r-- 521 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* this was written to test the term.c code, which was
   found on the web for use in XLisp to enable ^C and other
   character-by-character handling 
 */

#include "term.h"
#include <signal.h>

void ctcinit()
{
    signal(SIGINT, term_exit);
}


main()
{
    int c;
    int count = 0;
    term_init();
    term_character();
    while ((c = term_testchar()) == -2) count++;
    printf("got %c after %d\n", c, count);
    while ((c = getchar()) != 'x') {
        printf("got '%c' = %x\n", c, c);
    }
    term_exit();
}