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