How do you use ungetty?
Dmitry V. Volodin
dvv at hq.demos.su
Tue Sep 4 02:55:41 AEST 1990
In article <5540 at minyos.xx.rmit.oz> s892024 at minyos.xx.rmit.oz (Richard Muirden [G.A.]) writes:
>Hi, this is rather desperate!
>
>I need to diable getty running on /dev/tty1A while making a call out
>with a specialised dialer (ie: not uucp/cu) which is done automatically
>every morning. thus I want to rerun getty when the call has finished
>to reenable calls on that line.
>
>I believe that ungetty is what I need but there is **nothing** in the
>docs about it. I am running SCO Xenix/386 2.3.2
>
>Any help wanted/needed and apprieciated!! :-)
>
1) You should create /usr/spool/uucp/LCK..tty??? (LOWERCASE tty e.g. tty1a)!
2) You should do a trick with open/ioctl on the line (a piece of code
from /usr/lib/uucp/dialHA24.c ):
--------- CUT ---------
/* ........ */
/*
* Must open with O_NDELAY set or the open may hang.
*/
if ((fd = open(acu, O_RDWR | O_NDELAY)) < 0) {
fprintf(stderr, "dial: Can't open device: %s\n", acu);
exit(RC_FAIL | RCE_OPEN | retcode);
}
/*
* set line for no echo and correct speed.
* We will issue commands to the Hayes 2400 at the highest possible
* baud rate to encourage connection at the highest baud rate.
* If hanging up, issue commands at 2400 to enable auto answer
* at 2400.
*/
signal(SIGINT, abort);
errflag = ioctl(fd, TCGETA, &term);
term.c_cflag &= ~(CBAUD | HUPCL);
term.c_cflag |= CLOCAL | (hflag ? (B2400|HUPCL) : highbaud);
term.c_lflag &= ~ECHO;
term.c_cc[VMIN] = '\1';
term.c_cc[VTIME] = '\0';
errflag = ioctl(fd, TCSETA, &term);
if (errflag) {
char buf[16];
DEBUG(1, "dial: ioctl error on %s", acu);
DEBUG(1, " errno=%d\n", errno);
cleanup(RC_FAIL | RCE_IOCTL | retcode);
}
/*
* Reopen line with clocal so we can talk without carrier present
*/
c = fd;
/*!!!!*/if ((fd = open(acu, O_RDWR)) < 0) {
fprintf(stderr, "dial: Can't open device local: %s\n", acu);
exit(RC_FAIL | RCE_OPEN | retcode);
}
close(c);
--------- CUT ---------
Note the line marked /*!!!!*/. getty wakes up from waiting CD in this
particular moment and, finding /usr/spool/uucp/LCK..tty???, goes sleep
until this lock file is gone.
Dima <dvv at hq.demos.su> or <dvv%hq.demos.su at fuug.fi>
More information about the Comp.unix.xenix.sco
mailing list