From 84dd5d23ae7722fe644e1e77a6804b9a7c669de3 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 3 Mar 2008 09:52:59 -0700 Subject: [PATCH] agetty: make username-in-uppercase feature optional (off by default.) The following patch makes the username-in-upper-case feature optional. I have chosen to make it default to off since this feature was designed to cater for serial terminals that were last sold almost 30 years ago, thus the likelyhood that anyone will need this feature turned on is vanishingly small. Addresses-Debian-Bug: 156242 Signed-off-by: Hamish Coleman Signed-off-by: LaMont Jones Signed-off-by: Karel Zak --- login-utils/agetty.8 | 8 +++++++- login-utils/agetty.c | 11 +++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/login-utils/agetty.8 b/login-utils/agetty.8 index 5bde294b..87613747 100644 --- a/login-utils/agetty.8 +++ b/login-utils/agetty.8 @@ -3,7 +3,7 @@ agetty \- alternative Linux getty .SH SYNOPSIS -.BR "agetty " [\-8ihLmnw] +.BR "agetty " [\-8ihLmnUw] .RI "[-f " issue_file ] .RI "[-l " login_program ] .RI "[-I " init ] @@ -163,6 +163,12 @@ Force the line to be a local line with no need for carrier detect. This can be useful when you have a locally attached terminal where the serial line does not set the carrier detect signal. .TP +\-U +Turn on support for detecting an uppercase only terminal. This setting will +detect a login name containing only capitals as indicating an uppercase +only terminal and turn on some upper to lower case conversions. Note that +this has no support for any unicode characters. +.TP \-w Wait for the user or the modem to send a carriage-return or a linefeed character before sending the \fI/etc/issue\fP (or other) file diff --git a/login-utils/agetty.c b/login-utils/agetty.c index ff27b70b..6bbfb3f1 100644 --- a/login-utils/agetty.c +++ b/login-utils/agetty.c @@ -165,6 +165,7 @@ struct options { #define F_WAITCRLF (1<<5) /* wait for CR or LF */ #define F_CUSTISSUE (1<<6) /* give alternative issue file */ #define F_NOPROMPT (1<<7) /* don't ask for login name! */ +#define F_LCUC (1<<8) /* Support for *LCUC stty modes */ /* Storage for things detected while the login name was read. */ @@ -412,7 +413,7 @@ parse_args(argc, argv, op) extern int optind; /* getopt */ int c; - while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mt:wn"))) { + while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mt:wUn"))) { switch (c) { case '8': op->eightbits = 1; @@ -489,6 +490,9 @@ parse_args(argc, argv, op) case 'w': op->flags |= F_WAITCRLF; break; + case 'U': + op->flags |= F_LCUC; + break; default: usage(); } @@ -1116,8 +1120,7 @@ char *get_logname(op, cp, tp) } } /* Handle names with upper case and no lower case. */ - - if ((cp->capslock = caps_lock(logname))) { + if ((op->flags & F_LCUC) && (cp->capslock = caps_lock(logname))) { for (bp = logname; *bp; bp++) if (isupper(*bp)) *bp = tolower(*bp); /* map name to lower case */ @@ -1230,7 +1233,7 @@ bcode(s) void usage() { - fprintf(stderr, _("Usage: %s [-8hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\nor\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n"), progname); + fprintf(stderr, _("Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\nor\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n"), progname); exit(1); } -- 2.39.5