plocher@twobits.Eng.Sun.COM (John Plocher) (01/27/91)
/* ** I found this little gem while cleaning out some old disk space ** ** It is known to work on Microport's SysV 3.0 (and 3.0e) versions ** of V/386 and on the 2.4 version of V/AT for the 286. ** ** It is a simple demo of the typomatic ioctl for the console driver. ** ** It sets the repeat speed/threshold for the keyboard ** ** ** This code is released completely into the public domain ** ** John Plocher, January, 1991 */ #include <sys/kd_info.h> #define SNL(s) s,strlen( s ) void usage(); main( argc, argv ) int argc; char *argv[]; { int rate, result; if ( argc != 2 ) { usage( argv[0] ); exit( 1 ); } rate = *argv[1] - '0'; if ( rate < 0 || 9 < rate ) { usage( argv[0] ); exit( 1 ); } result = ioctl( 0, KDSETTYPO, rate ); if ( result == -1 ) { write( 2, SNL( "ioctl( 0, KDSETTYPO, rate ) failed\n" ) ); exit( 1 ); } return 0; } void usage( s ) char *s; { write( 2, SNL( "usage: " ) ); write( 2, SNL( s ) ); write( 2, SNL( " rate\n" ) ); write( 2, SNL( " rate must be [0-9]\n" ) ); }