aboutsummaryrefslogtreecommitdiffhomepage
path: root/demo/ex2.c
blob: eef251ef3562d500e7ea76adaf25167ff3fc4dcd (plain)
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
#include <stdio.h>
#include <slang.h>

int main ()
{
    int abort_char = 7;  /* For MSDOS, use 34 as scan code */
    unsigned int ch;

    if (-1 == SLang_init_tty (abort_char, 0, 1))
	{
	    fprintf (stderr, "Unable to initialize the terminal.\n");
	    exit (-1);
	}
    SLang_set_abort_signal (NULL);

    fflush (stdout);

    ch = SLang_getkey ();

    printf("<< %c >> %d ",ch, SLang_Error);

    SLang_reset_tty ();
    return 0;
}