diff options
-rw-r--r-- | login-utils/agetty.8 | 6 | ||||
-rw-r--r-- | login-utils/agetty.c | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/login-utils/agetty.8 b/login-utils/agetty.8 index 53037dda5..084086fda 100644 --- a/login-utils/agetty.8 +++ b/login-utils/agetty.8 @@ -3,7 +3,7 @@ agetty \- alternative Linux getty .SH SYNOPSIS -.BR "agetty " [\-8ihLmnsUw] +.BR "agetty " [\-c8ihLmnsUw] .RI "[-f " issue_file ] .RI "[-l " login_program ] .RI "[-I " init ] @@ -82,6 +82,10 @@ whatever init(8) may have set, and is inherited by login and the shell. .fi .ad .TP +\-c +Don't reset terminal cflags (control modes). See \fItermios(3)\fP for more +details. +.TP \-8 Assume that the tty is 8-bit clean, hence disable parity detection. .TP diff --git a/login-utils/agetty.c b/login-utils/agetty.c index 254194816..a6e249986 100644 --- a/login-utils/agetty.c +++ b/login-utils/agetty.c @@ -134,6 +134,7 @@ struct options { #define F_NOPROMPT (1<<7) /* don't ask for login name! */ #define F_LCUC (1<<8) /* Support for *LCUC stty modes */ #define F_KEEPSPEED (1<<9) /* Follow baud rate from kernel */ +#define F_KEEPCFLAGS (1<<10) /* Reuse c_cflags setup from kernel */ /* Storage for things detected while the login name was read. */ @@ -374,8 +375,11 @@ parse_args(argc, argv, op) extern int optind; /* getopt */ int c; - while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mst:wUn"))) { + while (isascii(c = getopt(argc, argv, "8cI:LH:f:hil:mst:wUn"))) { switch (c) { + case 'c': + op->flags |= F_KEEPCFLAGS; + break; case '8': op->eightbits = 1; break; @@ -709,7 +713,8 @@ termio_init(tp, op) /* flush input and output queues, important for modems! */ (void) tcflush(0, TCIOFLUSH); - tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL); + if (!(op->flags & F_KEEPCFLAGS)) + tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL); if (!(op->flags & F_KEEPSPEED)) { cfsetispeed(tp, op->speeds[FIRST_SPEED]); |