From 7fb65db12443da09d9a0f3be0c48021236333e28 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 26 Jun 2017 15:30:12 +0200 Subject: script: rename fixtty() to enable_rawmode_tty() Signed-off-by: Karel Zak --- term-utils/script.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'term-utils') diff --git a/term-utils/script.c b/term-utils/script.c index 19e9976d9..01be3d7c5 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -201,6 +201,19 @@ static void restore_tty(struct script_control *ctl, int mode) tcsetattr(STDIN_FILENO, mode, &rtt); } +static void enable_rawmode_tty(struct script_control *ctl) +{ + struct termios rtt; + + if (!ctl->isterm) + return; + + rtt = ctl->attrs; + cfmakeraw(&rtt); + rtt.c_lflag &= ~ECHO; + tcsetattr(STDIN_FILENO, TCSANOW, &rtt); +} + static void __attribute__((__noreturn__)) done(struct script_control *ctl) { DBG(MISC, ul_debug("done!")); @@ -605,18 +618,6 @@ static void __attribute__((__noreturn__)) do_shell(struct script_control *ctl) fail(ctl); } -static void fixtty(struct script_control *ctl) -{ - struct termios rtt; - - if (!ctl->isterm) - return; - - rtt = ctl->attrs; - cfmakeraw(&rtt); - rtt.c_lflag &= ~ECHO; - tcsetattr(STDIN_FILENO, TCSANOW, &rtt); -} static void getmaster(struct script_control *ctl) { @@ -773,7 +774,7 @@ int main(int argc, char **argv) getmaster(&ctl); if (!ctl.quiet) printf(_("Script started, file is %s\n"), ctl.fname); - fixtty(&ctl); + enable_rawmode_tty(&ctl); #ifdef HAVE_LIBUTEMPTER utempter_add_record(ctl.master, NULL); -- cgit v1.2.3-55-g7522