Annotation of os2sdk/demos/examples/keys/keys.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * keys.c - Demonstrate the OS/2 call KBDCHARIN
        !             3:  *
        !             4:  * This program runs in the forground. Cooked keystrokes are printed
        !             5:  * to the console.  Typing an ESC charactor terminates the program.
        !             6:  *
        !             7:  * This program can be bound to work under DOS 3.x (Family API).
        !             8:  *
        !             9:  */
        !            10: #define IOWAIT 0
        !            11: #define ESC '\033'
        !            12: #define COOKED 0x04
        !            13: #define RAW    0x08
        !            14: 
        !            15: #include <subcalls.h>
        !            16: #include <stdio.h>
        !            17: main ()
        !            18: {
        !            19:     struct KeyData keydata;
        !            20:     struct KbdStatus kbdstatus;
        !            21: 
        !            22:     kbdstatus.length = sizeof(kbdstatus);
        !            23:     KBDGETSTATUS(&kbdstatus, 0);
        !            24:     kbdstatus.bit_mask &= ~(RAW | COOKED);
        !            25:     kbdstatus.bit_mask |= COOKED;
        !            26:     KBDSETSTATUS (&kbdstatus, 0);
        !            27: 
        !            28:     do {
        !            29:        KBDCHARIN(&keydata, IOWAIT, 0);
        !            30:        printf("char: %02X  scan: %02X  status: %02X  shift: %04X\n",
        !            31:            keydata.char_code,
        !            32:            keydata.scan_code,
        !            33:            keydata.status,
        !            34:            keydata.shift_state);
        !            35: 
        !            36:     } while (keydata.char_code != ESC);
        !            37: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.