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: <89122504054842@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 From article <1989Dec15.082753.709@larouch.uucp>, by jparnas@larouch.uucp (Jacob Parnas): > (This in response to John Kennedy's and Axel's request for front end C code) (Above article used as a vehicle, as I'm novice here) The following C codes are substitutions for getty or uugetty. One is for System III to make port bidirectional and autobaudable. The other is formated for System V. A third one is for Xenix. System III code requiring two consecutive carrage returns cut uugetty.c here>>!SYSIII static char Version[] = "@(#)/usr/src/uugetty.c 3.6 27 Nov 89 - Centel"; /*********************************************** uugetty: Bidirectional getty 3.6 27 Nov 89"; System III version P. Mathis ************************************************/ #include /* used for database accesses only */ #include #include #include #include #define CR 0x0D extern char * strcpy(); extern sleep(); static char port[20] = "/dev/", crtty[35] = "/usr/spool/uucp/cr", Lock[35] = "/usr/spool/uucp/LCK..", cbuf[50], buf[100], pbuf[20], prg[34], *device, *speed, *optn; int parent, child, i=0, mask; int intrexit(); FILE *dbf; static int fd1, fd2, lockfd, pterm; static struct termio targ; /***... Interrupt routines ...***/ trap0() {intrexit();} trap1() {track("hang"); signal( SIGHUP, trap1 );} trap2() {track("intr(2)"); intrexit();} trap3() {track("quit(3)"); intrexit();} trap15() {track("term(15)"); intrexit();} intrexit() { conprint(0); } conprint(n) /*** Send trace msg to crfile/console. ***/ int n; { close(fd1); if(n == 0) ; else { fd2 = open("/dev/console", 1); write(fd2, buf, (unsigned)strlen(buf) ); close(fd2); } sleep(n); exit(0); } track(msg) char *msg; { sprintf(buf, "%9s\n",msg); write(fd1, buf, (unsigned)strlen(buf) ); } /*** Make interface translucent. ***/ xlucent( term, targp ) int term; struct termio *targp; { int baud; ioctl( term, TCGETA, targp ); /* get terminal parameters */ switch( atoi(speed) ) { case 5: baud = B300; break; case 3: baud = B1200; break; case 6: baud = B2400; break; case 8: baud = B4800; break; case 2: baud = B9600; break; default: sprintf(buf, "%s: invalid baud %s\n",prg, speed); conprint(60); } targp->c_iflag = (IGNBRK| ISTRIP | IGNPAR); /* set configuration */ targp->c_oflag = (NULL); targp->c_cflag &= ~CBAUD; targp->c_cflag |= (baud); *-*-*-*-* Message continued in next message *-*-*-*-* --- * Via MaSNet/HST96/HST144/V32 - UN Datacommun./Modems * Via Usenet Newsgroup comp.dcom.modems