summaryrefslogtreecommitdiffstats
path: root/libexec/rlogind/rlogind.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-11-02 17:00:56 +0000
committered <ed@FreeBSD.org>2010-11-02 17:00:56 +0000
commit568dc19750ccec553ab3df463967352da528cd93 (patch)
treef242e644964b102fa1b89235f6f64b8ce56638ed /libexec/rlogind/rlogind.c
parent3108c93ec3c2c606e4ec78a5f471565ab55e31a9 (diff)
downloadFreeBSD-src-568dc19750ccec553ab3df463967352da528cd93.zip
FreeBSD-src-568dc19750ccec553ab3df463967352da528cd93.tar.gz
Add a new libc function: cfmakesane(3).
I've noticed various terminal emulators that need to obtain a sane default termios structure use very complex `hacks'. Even though POSIX doesn't provide any functionality for this, extend our termios API with cfmakesane(3), which is similar to the commonly supported cfmakeraw(3), except that it fills the termios structure with sane defaults. Change all code in our base system to use this function, instead of depending on <sys/ttydefaults.h> to provide TTYDEF_*.
Diffstat (limited to 'libexec/rlogind/rlogind.c')
-rw-r--r--libexec/rlogind/rlogind.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c
index 5831a25..874112d 100644
--- a/libexec/rlogind/rlogind.c
+++ b/libexec/rlogind/rlogind.c
@@ -545,7 +545,7 @@ setup_term(int fd)
{
char *cp = index(term+ENVSIZE, '/');
char *speed;
- struct termios tt;
+ struct termios tt, def;
#ifndef notyet
tcgetattr(fd, &tt);
@@ -558,9 +558,10 @@ setup_term(int fd)
cfsetspeed(&tt, atoi(speed));
}
- tt.c_iflag = TTYDEF_IFLAG;
- tt.c_oflag = TTYDEF_OFLAG;
- tt.c_lflag = TTYDEF_LFLAG;
+ cfmakesane(&def);
+ tt.c_iflag = def.c_iflag;
+ tt.c_oflag = def.c_oflag;
+ tt.c_lflag = def.c_lflag;
tcsetattr(fd, TCSAFLUSH, &tt);
#else
if (cp) {
OpenPOWER on IntegriCloud