~ubuntu-branches/ubuntu/saucy/newt/saucy-proposed

« back to all changes in this revision

Viewing changes to showkey.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-11-08 14:50:00 UTC
  • mfrom: (2.1.20 sid)
  • Revision ID: package-import@ubuntu.com-20121108145000-0yfrol7obct0jufq
Tags: 0.52.14-11ubuntu1
* Merge with Debian; remaining changes:
  - Port python module to python3.
  - Fix installation for multiple python3 versions.
  - Move libnewt to /lib and whiptail to /bin so they can be used by
    friendly-recovery on systems that have a separate /usr.
  - debian/libnewt0.52.install, debian/libnewt0.52.postinst,
    debian/palette => debian/palette.original:
    - move palette from /usr to /etc such that they can be edited by an
      admin.
* Configure --with-colorsfile=/etc/newt/palette.

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