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: <89122504055194@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 *-*-*-*-* hangup() { signal(SIGHUP, hangup); track("HUP"); /* 01 watch for hangups */ conprint(0); } trap15() {track("TERM"); conprint(0);} conprint(n) /*** Send fatal msg to console and then die. ***/ 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) /*** Make tracks in uttyxx file ***/ char *msg; { sprintf(buf, "%10s\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(sspeed) ) /* allow 9600, 9600H bauds */ { case 30: baud = B300; break; case 12: baud = B1200; break; case 24: baud = B2400; break; case 48: baud = B4800; break; case 96: baud = B9600; break; case 19: baud = B19200; 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); targp->c_lflag = (NULL); targp->c_line = 0; 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, SIG_IGN ); /* 01 watch for hangups */ signal( SIGTERM, trap15 ); /* 15 watch for termination */ strcpy( &prg[0], argv[0] ); if (argc < 6) { sprintf(buf, "%s: Not enough Args\n", prg); conprint(60); } optt = argv[2]; optn = argv[3]; device = argv[4]; speed = argv[5]; strncat( sspeed, argv[5], 2 ); strcpy( &port[5], argv[4] ); /* /dev/tty?? */ strcpy( &lock[22], argv[4] ); /* LCK..tty?? */ strcpy( &trace[18], argv[4] ); /* utty?? */ sprintf(pbuf,"%10d\n\0",(getpid()) ); /* get current pid ready */ fd1 = creat(trace, 4); /* create tracking file */ track(pbuf); /* initialize with pid */ if(!(access(lock, 0))) checkout(lock,1); /* remove old lock if any */ if ((pterm = open( port, 2 )) < 0) { sprintf( buf, "%s: cannot open port %s\n",prg, port ); *-*-*-*-* Message continued in next message *-*-*-*-* --- * Via MaSNet/HST96/HST144/V32 - UN Datacommun./Modems * Via Usenet Newsgroup comp.dcom.modems