/* ephfc.c handle hardware flow control on EPORTS and then exec login This program sets hardware flow control on an EPORTS card in an AT&T 3B2 computer. Patch getty (or uugetty) to exec ephfc instead of login. 04/18/1992 - Elliot Dierksen (elliot@oau.org) */ /* standard header files */ #include #include #include #include #include /* EPORTS header files */ #include /*#include */ #include #include #define IN_FD 0 #define OUT_FD 1 main(argc,argv,envp) int argc; char **argv,**envp; { char *login_prog = "/bin/login"; struct etty ettyp; struct termio termiop; /* abort if ioctl read fails. this might happen this is not an EPORT */ if (ioctl(IN_FD,EP_GETA,&ettyp) == -1) { fprintf(stderr,"%s: ioctl(EP_GETA) failed(%d)\n",argv[0],errno); fflush(stderr); exit(6); } /* abort if ioctl read fails. No clue what might have gone wrong! */ if (ioctl(IN_FD,TCGETA,&termiop) == -1) { fprintf(stderr,"%s: ioctl(TCGETA) failed(%d)\n",argv[0],errno); fflush(stderr); exit(7); } /* turn off XON/XOFF */ termiop.c_iflag &= ~(IXON|IXOFF|IXANY); /* set regular ioctl values */ ioctl(OUT_FD,TCSETA,&termiop); /* set EPORTS values */ ioctl(OUT_FD,EP_HFC,0); /* reset arg[0] for login */ argv[0] = login_prog; /* exec login and hope for the best! */ execv(login_prog,argv); }