1*8284Scomay static char sccsid[] = "@(#)setmode.c 4.1 (Berkeley) 10/02/82"; 2*8284Scomay 3*8284Scomay /* 4*8284Scomay setmode.c 5*8284Scomay 6*8284Scomay used to set the mode to cat files to check the net tty drivers 7*8284Scomay */ 8*8284Scomay # include <stdio.h> 9*8284Scomay # include <sgtty.h> main(argc,argv)10*8284Scomaymain(argc,argv) 11*8284Scomay char **argv; { 12*8284Scomay struct sgttyb stt; 13*8284Scomay FILE *readtty; 14*8284Scomay if(fork() != 0)exit(0); 15*8284Scomay printf("kill %d\n",getpid()); 16*8284Scomay readtty = fopen(argv[1],"w"); 17*8284Scomay if(readtty == NULL)goto err1; 18*8284Scomay if(gtty(fileno(readtty),&stt) < 0)goto err2; 19*8284Scomay stt.sg_ispeed = stt.sg_ospeed = 9; /* 1200 baud */ 20*8284Scomay stt.sg_erase = stt.sg_kill = 0; /* erase and kill off */ 21*8284Scomay stt.sg_flags = ANYP; /* even and odd parity, off everything else */ 22*8284Scomay if(stty(fileno(readtty),&stt) < 0)goto err3; 23*8284Scomay sleep(30000); 24*8284Scomay err1: 25*8284Scomay printf("Error1: "); 26*8284Scomay perror(argv[1]); 27*8284Scomay exit(1); 28*8284Scomay err2: 29*8284Scomay printf("Error2: "); 30*8284Scomay perror(argv[1]); 31*8284Scomay exit(1); 32*8284Scomay err3: 33*8284Scomay printf("Error3: "); 34*8284Scomay perror(argv[1]); 35*8284Scomay exit(1); 36*8284Scomay } 37