11 |
|
*/ |
12 |
|
|
13 |
|
#include <stdio.h> |
14 |
– |
#include <signal.h> |
14 |
|
#include <sys/ioctl.h> |
15 |
|
|
16 |
|
#define INITSTR "" /* TTY initialization string */ |
22 |
|
int argc; |
23 |
|
char *argv[]; |
24 |
|
{ |
26 |
– |
int sigpid; |
25 |
|
int outfd; |
26 |
|
|
27 |
< |
if (argc != 3) |
27 |
> |
if (argc != 2) |
28 |
|
exit(1); |
29 |
< |
sigpid = atoi(argv[1]); |
32 |
< |
outfd = atoi(argv[2]); |
29 |
> |
outfd = atoi(argv[1]); |
30 |
|
|
31 |
|
fputs(INITSTR, stdout); |
32 |
|
fflush(stdout); |
44 |
|
ioctl(0, TIOCSETP, &ttymode); |
45 |
|
/* read lines from input */ |
46 |
|
for ( ; ; ) { |
47 |
< |
ungetc(getc(stdin), stdin); /* notify sigpid */ |
48 |
< |
kill(sigpid, SIGIO); |
47 |
> |
ungetc(getc(stdin), stdin); /* notify caller */ |
48 |
> |
putc(' ', stdout); |
49 |
> |
fflush(stdout); |
50 |
|
sendline(); |
51 |
|
} |
52 |
|
} |