util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Reisner <d@falconindy.com>
To: util-linux@vger.kernel.org
Cc: Dave Reisner <dreisner@archlinux.org>
Subject: [PATCH 07/13] sulogin: remove USE_ONELINE and SANE_TIO defines
Date: Tue, 28 Feb 2012 11:45:15 -0500	[thread overview]
Message-ID: <1330447521-886-8-git-send-email-dreisner@archlinux.org> (raw)
In-Reply-To: <1330447521-886-1-git-send-email-dreisner@archlinux.org>

This was only ever compiled in for a single distro, with no clear
indication of why.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
 login-utils/sulogin.c |   85 +------------------------------------------------
 1 file changed, 1 insertion(+), 84 deletions(-)

diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 218b17e..b6cbd05 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -63,79 +63,6 @@ struct sigaction saved_sigint;
 struct sigaction saved_sigtstp;
 struct sigaction saved_sigquit;
 
-#ifndef IUCLC
-#  define IUCLC	0
-#endif
-
-#if defined(SANE_TIO) && (SANE_TIO == 1)
-/*
- *	Fix the tty modes and set reasonable defaults.
- *	(I'm not sure if this is needed under Linux, but..)
- */
-static void fixtty(void)
-{
-	struct termios tty;
-	int serial;
-
-	/* Skip serial console */
-	if (ioctl (0, TIOCMGET, (char*)&serial) == 0)
-		goto out;
-	/* Expected error */
-	serial = errno = 0;
-
-	tcgetattr(0, &tty);
-
-	/* Use defaults of <sys/ttydefaults.h> for base settings */
-	tty.c_iflag |= TTYDEF_IFLAG;
-	tty.c_oflag |= TTYDEF_OFLAG;
-	tty.c_lflag |= TTYDEF_LFLAG;
-	tty.c_cflag |= (TTYDEF_SPEED | TTYDEF_CFLAG);
-
-	/* Sane setting, allow eight bit characters, no carriage return delay
-	 * the same result as `stty sane cr0 pass8'
-	 */
-	tty.c_iflag |=  (BRKINT | ICRNL | IMAXBEL);
-#ifdef IUTF8 /* Not defined on FreeBSD */
-	tty.c_iflag |= IUTF8;
-#endif /* IUTF8 */
-	tty.c_iflag &= ~(IGNBRK | INLCR | IGNCR | IXOFF | IUCLC | IXANY | ISTRIP);
-	tty.c_oflag |=  (OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0);
-	tty.c_oflag &= ~(OLCUC | OCRNL | ONOCR | ONLRET | OFILL | OFDEL |\
-			 NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
-	tty.c_lflag |=  (ISIG | ICANON | IEXTEN | ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE);
-	tty.c_lflag &= ~(ECHONL | NOFLSH | XCASE | TOSTOP | ECHOPRT);
-	tty.c_cflag |=  (CREAD | CS8 | B9600);
-	tty.c_cflag &= ~(PARENB);
-
-	/* VTIME and VMIN can overlap with VEOF and VEOL since they are
-	 * only used for non-canonical mode. We just set the at the
-	 * beginning, so nothing bad should happen.
-	 */
-	tty.c_cc[VTIME]    = 0;
-	tty.c_cc[VMIN]     = 1;
-	tty.c_cc[VINTR]    = CINTR;
-	tty.c_cc[VQUIT]    = CQUIT;
-	tty.c_cc[VERASE]   = CERASE; /* ASCII DEL (0177) */
-	tty.c_cc[VKILL]    = CKILL;
-	tty.c_cc[VEOF]     = CEOF;
-	tty.c_cc[VSWTC]    = _POSIX_VDISABLE;
-	tty.c_cc[VSTART]   = CSTART;
-	tty.c_cc[VSTOP]    = CSTOP;
-	tty.c_cc[VSUSP]    = CSUSP;
-	tty.c_cc[VEOL]     = _POSIX_VDISABLE;
-	tty.c_cc[VREPRINT] = CREPRINT;
-	tty.c_cc[VDISCARD] = CDISCARD;
-	tty.c_cc[VWERASE]  = CWERASE;
-	tty.c_cc[VLNEXT]   = CLNEXT;
-	tty.c_cc[VEOL2]    = _POSIX_VDISABLE;
-
-	tcsetattr(0, TCSANOW, &tty);
-out:
-	return;
-}
-#endif
-
-
 /*
  *	Called at timeout.
  */
@@ -366,18 +293,12 @@ static char *getpasswd(char *crypted)
 	static char pass[128];
 	char *ret = pass;
 	int i;
-#if defined(USE_ONELINE)
-	if (crypted[0])
-		printf("Give root password for login: ");
-	else
-		printf("Press enter for login: ");
-#else
+
 	if (crypted[0])
 		printf("Give root password for maintenance\n");
 	else
 		printf("Press enter for maintenance");
 	printf("(or type Control-D to continue): ");
-#endif
 	fflush(stdout);
 
 	tcgetattr(0, &old);
@@ -597,10 +518,6 @@ int main(int argc, char **argv)
 			perror("ioctl(TIOCSCTTY)");
 	}
 
-#if defined(SANE_TIO) && (SANE_TIO == 1)
-	fixtty();
-#endif
-
 	/*
 	 *	Get the root password.
 	 */
-- 
1.7.9.2


  parent reply	other threads:[~2012-02-28 16:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 16:45 [PATCH 00/13] Initial import of sulogin Dave Reisner
2012-02-28 16:45 ` [PATCH 01/13] fstab.5: fix misspelling of deprecated Dave Reisner
2012-02-28 16:45 ` [PATCH 02/13] sulogin: initial import from sysvinit Dave Reisner
2012-02-28 18:45   ` Davidlohr Bueso
2012-02-28 16:45 ` [PATCH 03/13] sulogin.8: refactor manpage Dave Reisner
2012-02-28 16:45 ` [PATCH 04/13] sulogin: whitespace fixes Dave Reisner
2012-02-28 16:45 ` [PATCH 05/13] sulogin: replace older signal() with sigaction() Dave Reisner
2012-02-28 16:45 ` [PATCH 06/13] sulogin: remove CHECK_{DES,MD5} defines Dave Reisner
2012-02-28 16:45 ` Dave Reisner [this message]
2012-02-28 16:45 ` [PATCH 08/13] sulogin: use size_t for iterator to avoid cast Dave Reisner
2012-02-28 16:45 ` [PATCH 09/13] sulogin: get rid of calls to /bin/sash Dave Reisner
2012-02-28 16:45 ` [PATCH 10/13] sulogin: use pathnames.h for file locations Dave Reisner
2012-02-28 16:45 ` [PATCH 11/13] sulogin: header/include cleanup Dave Reisner
2012-02-28 16:45 ` [PATCH 12/13] sulogin: use a more standard usage output Dave Reisner
2012-02-28 16:45 ` [PATCH 13/13] sulogin: add i18n strings Dave Reisner
2012-02-28 16:48 ` [PATCH 00/13] Initial import of sulogin Dave Reisner
2012-10-12 12:53   ` [util-linux] " Dr. Werner Fink
2012-10-12 13:23     ` Karel Zak
2012-10-12 14:07       ` Dr. Werner Fink
2012-11-09  8:38         ` Karel Zak
2012-11-09  8:45           ` Karel Zak
2012-11-09 12:09         ` Karel Zak
2012-11-30 15:57           ` Dr. Werner Fink
2012-12-04 12:12             ` Dr. Werner Fink
2012-03-12 14:20 ` sulogin merged into util-linux (Re: [PATCH 00/13] Initial import of sulogin) Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330447521-886-8-git-send-email-dreisner@archlinux.org \
    --to=d@falconindy.com \
    --cc=dreisner@archlinux.org \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).