Example: #include #include #include #include #include #include #include #define NONE 0 #define ERROR -1 void main(int argc, char **argv) { int fd; long mode; if (argc < 2) { printf("Usage: %s \n\n"); printf("Mode is one of the following values:\n"); printf("0x03 - K_METABIT (set high order bit)\n"); printf("0x03 - K_ESCPREFIX (escape prefix)\n\n"); } /* To be used as the fd in ioctl(). */ if ((fd = open("/dev/console", O_NOCTTY)) == ERROR) { perror("open"); exit(ERROR); } printf("w00w00!\n\n"); printf("Setting meta key handler mode "); mode = atoi(argv[1]); if (mode == NONE) printf("off.\n"); else if (mode == K_METABIT) printf("to: set high order bit.\n"); else if (mode == K_ESCPREFIX) printf("to: escape prefix.\n"); else printf("0x0%x\n", mode); /* For future values */ if ((ioctl(fd, KDSKBMETA, mode)) == ERROR) { perror("ioctl"); close(fd); exit(ERROR); } putchar('\n'); close(fd); }