Example #1
0
/*
 * Remove all characters in all DRCS sets (the " @" is a dummy name)
 */
static int
tst_cleanup(MENU_ARGS)
{
  do_dcs("1;1;2%c @", L_CURL);
  padding(20);
  return MENU_NOHOLD;
}
Example #2
0
static int
tst_DECUDK(MENU_ARGS)
{
    int key;
  /* *INDENT-OFF* */
  static struct {
    int code;
    const char *name;
  } keytable[] = {
    /* xterm programs these: */
    { 11, "F1" },
    { 12, "F2" },
    { 13, "F3" },
    { 14, "F4" },
    { 15, "F5" },
    /* vt420 programs these: */
    { 17, "F6" },
    { 18, "F7" },
    { 19, "F8" },
    { 20, "F9" },
    { 21, "F10" },
    { 23, "F11" },
    { 24, "F12" },
    { 25, "F13" },
    { 26, "F14" },
    { 28, "F15" },
    { 29, "F16" },
    { 31, "F17" },
    { 32, "F18" },
    { 33, "F19" },
    { 34, "F20" } };
  /* *INDENT-ON* */

    for (key = 0; key < TABLESIZE(keytable); key++) {
        char temp[80];
        const char *s;
        temp[0] = '\0';
        for (s = keytable[key].name; *s; s++)
            sprintf(temp + strlen(temp), "%02x", *s & 0xff);
        do_dcs("1;1|%d/%s", keytable[key].code, temp);
    }

    vt_move(1, 1);
    println(the_title);
    println("Press 'q' to quit.  Function keys should echo their labels.");
    println("(On a DEC terminal you must press SHIFT as well).");

    set_tty_raw(TRUE);
    set_tty_echo(FALSE);

    for (;;) {
        char *report = instr();
        if (*report == 'q')
            break;
        vt_move(5, 10);
        vt_clear(0);
        chrprint(report);
    }

    do_dcs("0");  /* clear all keys */

    restore_ttymodes();
    vt_move(max_lines - 1, 1);
    return MENU_HOLD;
}