Example: #include #include #include #include #include #include #include #define NONE 0 #define ERROR -1 void main() { int fd; long mode; /* To be used as the fd in ioctl(). */ if ((fd = open("/dev/console", O_NOCTTY)) == ERROR) { perror("open"); exit(ERROR); } printf("w00w00!\n\n"); if ((ioctl(fd, KDGKBMETA, &mode)) == ERROR) { perror("ioctl"); close(fd); exit(ERROR); } printf("Meta key handler is "); if (mode == NONE) printf("not set.\n"); else if (mode == K_METABIT) printf("setting high order bit.\n"); else if (mode == K_ESCPREFIX) printf("the escape prefix.\n"); else printf("0x0%x\n", mode); /* For future modes.\n"); putchar('\n'); close(fd); }