mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
Add 'nc' flag to gettytab -- no carrier. Forces non-blocking open and
setting of CLOCAL. Necessary for 3 wire RS-232 setups with dumb terminals. PR: 5959
This commit is contained in:
parent
c85540dd55
commit
3d4a189e9f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64076
|
@ -145,6 +145,7 @@ hangup line on last close
|
|||
.It "lo str" Ta Pa /usr/bin/login Ta
|
||||
.No "program to exec when name obtained"
|
||||
.It "mb bool false do flow control based on carrier"
|
||||
.It "nc bool false terminal does not supply carrier (set clocal)"
|
||||
.It "nl bool false terminal has (or might have) a newline character"
|
||||
.It "np bool false terminal uses no parity (i.e. 8-bit characters)"
|
||||
.It "nx str default next table (for auto speed selection)"
|
||||
|
|
|
@ -170,5 +170,6 @@ struct gettyflags {
|
|||
#define DX gettyflags[20].value
|
||||
#define NP gettyflags[21].value
|
||||
#define MB gettyflags[22].value
|
||||
#define HW gettyflags[23].value
|
||||
#define HW gettyflags[23].value
|
||||
#define NC gettyflags[24].value
|
||||
|
||||
|
|
|
@ -146,5 +146,6 @@ struct gettyflags gettyflags[] = {
|
|||
{ "np", 0 }, /* no parity at all (8bit chars) */
|
||||
{ "mb", 0 }, /* do MDMBUF flow control */
|
||||
{ "hw", 0 }, /* do CTSRTS flow control */
|
||||
{ "nc", 0 }, /* set clocal (no carrier) */
|
||||
{ 0 }
|
||||
};
|
||||
|
|
|
@ -270,8 +270,8 @@ main(argc, argv)
|
|||
(void)tcsetattr(STDIN_FILENO, TCSANOW, &tmode);
|
||||
exit(1);
|
||||
}
|
||||
} else { /* blocking open */
|
||||
if (!opentty(ttyn, O_RDWR))
|
||||
} else { /* maybe blocking open */
|
||||
if (!opentty(ttyn, O_RDWR | (NC ? O_NONBLOCK : 0 )))
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -293,6 +293,7 @@ main(argc, argv)
|
|||
tmode.c_oflag = TTYDEF_OFLAG;
|
||||
tmode.c_lflag = TTYDEF_LFLAG;
|
||||
tmode.c_cflag = TTYDEF_CFLAG;
|
||||
tmode.c_cflag |= (NC ? CLOCAL : 0);
|
||||
omode = tmode;
|
||||
|
||||
for (;;) {
|
||||
|
|
Loading…
Reference in a new issue