~ubuntu-branches/ubuntu/dapper/newt/dapper-security

« back to all changes in this revision

Viewing changes to showkey.c

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2002-03-31 09:38:18 UTC
  • Revision ID: james.westby@ubuntu.com-20020331093818-t3cla7103r07qnyw
Tags: upstream-0.50.17
ImportĀ upstreamĀ versionĀ 0.50.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <slang.h>
 
3
 
 
4
int main(void) {
 
5
    char n = 0;
 
6
    int i;
 
7
    char * buf;
 
8
 
 
9
    SLtt_get_terminfo();
 
10
    SLang_init_tty(4, 0, 0);
 
11
 
 
12
    buf = SLtt_tgetstr("ku");
 
13
    if (!buf) {
 
14
        printf("termcap entry not found for kl\n\r");
 
15
    } else {
 
16
        printf("termcap entry found for kl: %s", buf);
 
17
        while (*buf) {
 
18
            printf("0x%02x ", *buf++);
 
19
        }
 
20
        printf("\n\r");
 
21
    }
 
22
 
 
23
    printf("\n\r");
 
24
 
 
25
    printf("Press a key: ");
 
26
    fflush(stdout);
 
27
   
 
28
    SLang_input_pending(50);
 
29
 
 
30
    printf("\n\r");
 
31
    printf("You pressed: ");
 
32
 
 
33
    while (SLang_input_pending(1)) {
 
34
        i = SLang_getkey();
 
35
        printf("0x%02x ", i);
 
36
    }
 
37
 
 
38
    printf("\n\r");
 
39
 
 
40
    SLang_reset_tty();
 
41
}