I guess I can just put this up. Most of these have been sitting here forever.
This commit is contained in:
commit
d2777092d1
26 changed files with 5347 additions and 0 deletions
21
totty.c
Normal file
21
totty.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
char *tty = "/dev/tty1";
|
||||
if ( argc > 1 ) tty = argv[1];
|
||||
int fd = open(tty,O_RDWR);
|
||||
if ( !fd == -1 )
|
||||
{
|
||||
perror("open tty failed");
|
||||
return 1;
|
||||
}
|
||||
int mchar = 0;
|
||||
while ( (mchar = getchar()) != EOF )
|
||||
ioctl(fd,TIOCSTI,&mchar);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue