#include #include #include #include #include main(argc,argv) char *argv[]; int argc; { struct kiockey ky; int fd; if(argc !=4){ fprintf(stderr,"%s: format: %s key_number string_number key_string\n", argv[0],argv[0]); exit(2); } if((fd = open("/dev/kbd",O_RDWR)) <0){ fprintf(stderr,"can't open keyboard\n"); exit(2); } ky.kio_station = atoi(argv[1]); /* key number */ strcpy(ky.kio_string,argv[3]); /* string to assign to key */ ky.kio_tablemask = 0; /* bare key */ ky.kio_entry = STRING+atoi(argv[2]); /* key to send a string */ if(ioctl(fd,KIOCSETKEY,&ky)){ fprintf(stderr,"%s: ioctl for keyboard failed\n",argv[0]); exit(1); } exit(0); }