Path: utzoo!utgpu!jarvis.csri.toronto.edu!torsqnt!tmsoft!masnet!canremote!perry@macom1.uucp From: perry@macom1.uucp@canremote.uucp (perry@macom1.UUCP) Newsgroups: comp.dcom.modems Subject: Re: Telebit config Question c Message-ID: <89122504055029@masnet.uucp> Date: 21 Dec 89 05:05:00 GMT Organization: Canada Remote Systems Limited, Mississauga, ON, Canada Lines: 98 From: perry@macom1.UUCP (Guru's Inc.) Subj: Telebit config Question c-code uugetty Orga: CENTEL Federal Systems, Reston, VA. 22091-1506 *-*-*-*-* Message continued from prior message *-*-*-*-* targp->c_lflag = (NULL); targp->c_cc[VMIN] = 1; targp->c_cc[VTIME] = 0; ioctl( term, TCSETA, targp ); } main( argc, argv ) int argc; char **argv; { int inithookup = 1; static char buf2[8], nuls[8] = '\0'; long lseek(), offset = 12L; int fd; signal( SIGHUP, trap1 ); /* 01 watch for hangups */ signal( SIGINT, trap2 ); /* 02 watch for interrupts */ signal( SIGQUIT, trap3 ); /* 03 watch for quit */ signal( SIGTERM, trap15 ); /* 15 watch for termination */ strcpy( &prg[0], argv[0] ); if (argc < 3) { sprintf(buf, "%s: Not Enough Arguments\n", prg); conprint(60); } device = argv[1]; speed = argv[2], optn = argv[3]; if( argv[3] == "" || argv[3] == "#" ) optn = "60"; strcpy( &port[5], argv[1] ); /* /dev/tty?? */ strcpy( &Lock[21], argv[1] ); /* LCK..tty?? */ strcpy( &crtty[18], argv[1] ); /* crtty?? */ fd = open ( "/etc/utmp", 2); /* clear last who */ while ( read (fd, buf2, 8) ) { if ( !(strcmp(buf2, argv[1])) ) { write (fd, nuls, 8); break; } else { lseek (fd, offset, 1); } } close(fd); sprintf(pbuf, "%10d\n%s\n", (getpid()), device ); /* get lockf ready */ fd1 = creat(crtty, 4); write(fd1, pbuf, 10 ); if(!(access(Lock, 0))) checkout(Lock); /* remove old lock if any */ if ((pterm = open( port, 2 )) < 0) { track("erropen"); sprintf( buf, "%s: cannot open port %s\n",prg, port ); conprint(60); } xlucent( pterm, &targ ); /* make port translucent */ ioctl( pterm, TCFLSH, 2 ); sprintf(buf, "chown uucp %s", port ); system(buf); /* give ownership */ while( wait_on_CR( pterm ) ) intread(); /* wait for connect request */ while (inithookup) { parent = getpid(); /* get id of this process */ if ((child = fork()) == 0) { sleep(5); exit(0); /* child holds line open */ } else { if (inithookup) { inithookup = 0; /* hookup is done */ execl("/etc/getty", "getty", device, speed, optn, 0); } } } } /*** end main ***/ wait_on_CR( term ) /*** Wait for connect message. ***/ int term; { char k, c; track("listen"); while (1) { if (read( term, &c, 1 ) <= 0) /* get a character from unix */ { k = c = '\0'; return (1); /* interrupt returned */ } if (!(access(Lock, 0))) checkout(Lock); if ( c == CR ) { *-*-*-*-* Message continued in next message *-*-*-*-* --- * Via MaSNet/HST96/HST144/V32 - UN Datacommun./Modems * Via Usenet Newsgroup comp.dcom.modems