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!"));
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)
{
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);