diff options
author | ed <ed@FreeBSD.org> | 2010-11-02 17:00:56 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2010-11-02 17:00:56 +0000 |
commit | 568dc19750ccec553ab3df463967352da528cd93 (patch) | |
tree | f242e644964b102fa1b89235f6f64b8ce56638ed /libexec/getty/main.c | |
parent | 3108c93ec3c2c606e4ec78a5f471565ab55e31a9 (diff) | |
download | FreeBSD-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/getty/main.c')
-rw-r--r-- | libexec/getty/main.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libexec/getty/main.c b/libexec/getty/main.c index ad53411..ced1573 100644 --- a/libexec/getty/main.c +++ b/libexec/getty/main.c @@ -454,8 +454,9 @@ opentty(const char *tty, int flags) } static void -defttymode() +defttymode(void) { + struct termios def; /* Start with default tty settings. */ if (tcgetattr(STDIN_FILENO, &tmode) < 0) { @@ -471,10 +472,11 @@ defttymode() * to leave their idea of the preferred VERASE key value * there. */ - tmode.c_iflag = TTYDEF_IFLAG; - tmode.c_oflag = TTYDEF_OFLAG; - tmode.c_lflag = TTYDEF_LFLAG; - tmode.c_cflag = TTYDEF_CFLAG; + cfmakesane(&def); + tmode.c_iflag = def.c_iflag; + tmode.c_oflag = def.c_oflag; + tmode.c_lflag = def.c_lflag; + tmode.c_cflag = def.c_cflag; if (NC) tmode.c_cflag |= CLOCAL; omode = tmode; |