Skip to contentSkip to conversation

agetty: remove variable that is set but not read

PATCH In review Sami Kerola 3 participants 14 messages Apr 2, 2017 – Apr 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 agetty: remove variable that is set but not read

---
 term-utils/agetty.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
term-utils/agetty.c +2 -7
index da6c9e5e3..6a2085a3c 100644
@@ -1279,15 +1279,10 @@ static void termio_init(struct options *op, struct termios *tp)
 
 	/* Check for terminal size and if not found set default */
 	if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == 0) {
-		int set = 0;
-		if (ws.ws_row == 0) {
+		if (ws.ws_row == 0)
 			ws.ws_row = 24;
-			set++;
-		}
-		if (ws.ws_col == 0) {
+		if (ws.ws_col == 0)
 			ws.ws_col = 80;
-			set++;
-		}
 		if (ioctl(STDIN_FILENO, TIOCSWINSZ, &ws))
 			debug("TIOCSWINSZ ioctl failed\n");
 	}
Signature · 1 line
2.12.2
#1 lore raw

PATCH 2/3 lib/cpuset: stop changing variable that is not read

---
 lib/cpuset.c | 1 -
 1 file changed, 1 deletion(-)
lib/cpuset.c +0 -1
index fbe99e2a5..6d82522f5 100644
@@ -255,7 +255,6 @@ int cpumask_parse(const char *str, cpu_set_t *set, size_t setsize)
 			CPU_SET_S(cpu + 2, setsize, set);
 		if (val & 8)
 			CPU_SET_S(cpu + 3, setsize, set);
-		len--;
 		ptr--;
 		cpu += 4;
 	}
Signature · 1 line
2.12.2
#2 lore raw

PATCH 3/3 agetty: make --remote to forward --nohostname as -H to login

In reply to Sami Kerola

Without this change an attempt to remove hostname printing required following rather clumsy agetty invocation.

  /sbin/agetty --nohostname --login-options '/bin/login -H -- \u'

After the change --nohostname behaves similar way with --host option, that is when combined with --remote the effect is passed to login(1).

In same go improve manual page a little bit. This includes small mistake in commit 01095ae33c that claimed option -r is added to command line when passing hostname login while it should have been -h.

---
 term-utils/agetty.8 | 27 +++++++++++++++++----------
 term-utils/agetty.c |  9 ++++++---
 2 files changed, 23 insertions(+), 13 deletions(-)
term-utils/agetty.8 +17 -10
index 40be8b46c..bdb1a7d35 100644
@@ -90,18 +90,22 @@ Assume that the tty is 8-bit clean, hence disable parity detection.
 .TP
 \-a, \-\-autologin \fIusername\fP
 Log the specified user automatically in without asking for a login name and
-password.  The \-f \fIusername\fP option is added to the \fB/bin/login\fP
-command line by default.  The \-\-login\-options option changes this default
-behavior and then only \\u is replaced by the \fIusername\fP and no other
-option is added to the login command line.
+password.  The \-f \fIusername\fP option and argument are added to the
+\fB/bin/login\fP command line by default.  The \-\-login\-options option
+changes this default behavior and then only \\u is replaced by the
+\fIusername\fP and no other option is added to the login command line.
 .TP
 \-c, \-\-noreset
 Don't reset terminal cflags (control modes).  See \fBtermios\fP(3) for more
 details.
 .TP
 \-E, \-\-remote
-If an \fB\-H\fP \fIfakehost\fP option is given, then an \fB\-r\fP
-\fIfakehost\fP option is added to the \fB/bin/login\fP command line.
+If an \fB\-\-host\fP \fIfakehost\fP option is given, then an \fB\-h\fP
+\fIfakehost\fP option and argument are added to the \fB/bin/login\fP
+command line.
+.IP
+If an \fB\-\-nohost\fR option is given, then an \fB\-H\fP option
+is added to the \fB/bin/login\fP command line.
 .TP
 \-f, \-\-issue\-file \fIissue_file\fP
 Display the contents of \fIissue_file\fP instead of \fI/etc/issue\fP.
@@ -184,9 +188,11 @@ Do not print a newline before writing out /etc/issue.
 .TP
 \-o, \-\-login\-options "\fIlogin_options\fP"
 Options  that  are passed to the login program.  \\u is replaced
-by the login name.  The default \fB/bin/login\fP command line
-is "/bin/login -- <username>".
-
+by the login name.  The default login options string is
+"/bin/login -- \\u".
+.IP
+See also \fB\-\-autologin\fR and \fB\-\-remote\fR options.
+.IP
 Please read the SECURITY NOTICE below if you want to use this.
 .TP
 \-p, \-\-login\-pause
@@ -217,7 +223,8 @@ Note that this has no support for any Unicode characters.
 \-w, \-\-wait\-cr
 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
-and the login prompt.  Very useful in connection with the \-I option.
+and the login prompt.  Very useful in connection with the \-\-init\-string
+option.
 .TP
 \-\-nohints
 Do not print hints about Num, Caps and Scroll Locks.
term-utils/agetty.c +6 -3
index 6a2085a3c..93a3843c7 100644
@@ -493,9 +493,12 @@ int main(int argc, char **argv)
 		login_options_to_argv(login_argv, &login_argc,
 				      options.logopt, username);
 	} else {
-		if (fakehost && (options.flags & F_REMOTE)) {
-			login_argv[login_argc++] = "-h";
-			login_argv[login_argc++] = fakehost;
+		if (options.flags & F_REMOTE) {
+			if (fakehost) {
+				login_argv[login_argc++] = "-h";
+				login_argv[login_argc++] = fakehost;
+			} else if (options.flags & F_NOHOSTNAME)
+				login_argv[login_argc++] = "-H";
 		}
 		if (username) {
 			if (options.autolog)
Signature · 1 line
2.12.2
#3 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

Quoted 23 lines · Sami Kerola

Without this change an attempt to remove hostname printing required following rather clumsy agetty invocation.

  /sbin/agetty --nohostname --login-options '/bin/login -H -- \u'

After the change --nohostname behaves similar way with --host option, that is when combined with --remote the effect is passed to login(1).

In same go improve manual page a little bit. This includes small mistake in commit 01095ae33c that claimed option -r is added to command line when passing hostname login while it should have been -h.

---
 term-utils/agetty.8 | 27 +++++++++++++++++----------
 term-utils/agetty.c |  9 ++++++---
 2 files changed, 23 insertions(+), 13 deletions(-)
term-utils/agetty.8 +0 -0
index 40be8b46c..bdb1a7d35 100644

term-utils/agetty.8 Assume that the tty is 8-bit clean, hence disable parity detection. · line 92

Quoted 3 lines
term-utils/agetty.8 +0 -0
@@ -90,18 +90,22 @@ Assume that the tty is 8-bit clean, hence disable parity detection.
 .TP
 \-a, \-\-autologin \fIusername\fP
 Log the specified user automatically in without asking for a login name and

Hey Sami, since you're here you might want to fix this too?

Log in the specified user automatically without asking for a name and
OR
Automatically log in the specified user without asking for a name and

I think the second is better.

term-utils/agetty.8 Assume that the tty is 8-bit clean, hence disable parity detection. · line 93

Quoted 5 lines
term-utils/agetty.8 +1 -4
-password.  The \-f \fIusername\fP option is added to the \fB/bin/login\fP
-command line by default.  The \-\-login\-options option changes this default
-behavior and then only \\u is replaced by the \fIusername\fP and no other
-option is added to the login command line.
+password.  The \-f \fIusername\fP option and argument are added to the

The \-f should be bold.

term-utils/agetty.8 Assume that the tty is 8-bit clean, hence disable parity detection. · line 94

Quoted 1 line
term-utils/agetty.8 +1 -0
+\fB/bin/login\fP command line by default.  The \-\-login\-options option

That reads a bit awkward (and it's not in bold), how about just:

.RB Using \ \-\-login\-options

term-utils/agetty.8 Assume that the tty is 8-bit clean, hence disable parity detection. · line 103

Quoted 11 lines
term-utils/agetty.8 +3 -2
+changes this default behavior and then only \\u is replaced by the
+\fIusername\fP and no other option is added to the login command line.
 .TP
 \-c, \-\-noreset
 Don't reset terminal cflags (control modes).  See \fBtermios\fP(3) for more
 details.
 .TP
 \-E, \-\-remote
-If an \fB\-H\fP \fIfakehost\fP option is given, then an \fB\-r\fP
-\fIfakehost\fP option is added to the \fB/bin/login\fP command line.
+If an \fB\-\-host\fP \fIfakehost\fP option is given, then an \fB\-h\fP

If a \fB\-\-host\fP

term-utils/agetty.8 Assume that the tty is 8-bit clean, hence disable parity detection. · line 107

Quoted 4 lines
term-utils/agetty.8 +4 -0
+\fIfakehost\fP option and argument are added to the \fB/bin/login\fP
+command line.
+.IP
+If an \fB\-\-nohost\fR option is given, then an \fB\-H\fP option

If a \fB\-\-nohost\fR

Actually, they all should be using 'the'. Although it is common for util-linux man-pages' to use the a/an indefinite article for command and option names; they are specific nouns that require using the definite article 'the'.

https://owl.english.purdue.edu/owl/resource/540/01/

term-utils/agetty.8 Do not print a newline before writing out /etc/issue. · line 192

Quoted 13 lines
term-utils/agetty.8 +3 -3
+is added to the \fB/bin/login\fP command line.
 .TP
 \-f, \-\-issue\-file \fIissue_file\fP
 Display the contents of \fIissue_file\fP instead of \fI/etc/issue\fP.
@@ -184,9 +188,11 @@ Do not print a newline before writing out /etc/issue.
 .TP
 \-o, \-\-login\-options "\fIlogin_options\fP"
 Options  that  are passed to the login program.  \\u is replaced
-by the login name.  The default \fB/bin/login\fP command line
-is "/bin/login -- <username>".
-
+by the login name.  The default login options string is
+"/bin/login -- \\u".

by the login name. The default login command is
.BR "/bin/login -- \\u" .

term-utils/agetty.8 Do not print a newline before writing out /etc/issue. · line 194

Quoted 2 lines
term-utils/agetty.8 +2 -0
+.IP
+See also \fB\-\-autologin\fR and \fB\-\-remote\fR options.

Also see the \fB\-\-autologin\fR and \fB\-\-remote\fR options.

term-utils/agetty.8 Do not print a newline before writing out /etc/issue. · line 196

Quoted 2 lines
term-utils/agetty.8 +1 -0
+.IP
 Please read the SECURITY NOTICE below if you want to use this.

Please read the SECURITY NOTICE below before using this option.

term-utils/agetty.8 Note that this has no support for any Unicode characters. · line 226

Quoted 8 lines
term-utils/agetty.8 +1 -1
 .TP
 \-p, \-\-login\-pause
@@ -217,7 +223,8 @@ Note that this has no support for any Unicode characters.
 \-w, \-\-wait\-cr
 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
-and the login prompt.  Very useful in connection with the \-I option.
+and the login prompt.  Very useful in connection with the \-\-init\-string

This is useful with the \-\-init\-string

Quoted 25 lines
term-utils/agetty.8 +1 -0
+option.
 .TP
 \-\-nohints
 Do not print hints about Num, Caps and Scroll Locks.
term-utils/agetty.c +6 -3
index 6a2085a3c..93a3843c7 100644
@@ -493,9 +493,12 @@ int main(int argc, char **argv)
 		login_options_to_argv(login_argv, &login_argc,
 				      options.logopt, username);
 	} else {
-		if (fakehost && (options.flags & F_REMOTE)) {
-			login_argv[login_argc++] = "-h";
-			login_argv[login_argc++] = fakehost;
+		if (options.flags & F_REMOTE) {
+			if (fakehost) {
+				login_argv[login_argc++] = "-h";
+				login_argv[login_argc++] = fakehost;
+			} else if (options.flags & F_NOHOSTNAME)
+				login_argv[login_argc++] = "-H";
 		}
 		if (username) {
 			if (options.autolog)
#4 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

Quoted 19 lines · J William Piggott
Quoted 18 lines · Sami Kerola

Without this change an attempt to remove hostname printing required following rather clumsy agetty invocation.

  /sbin/agetty --nohostname --login-options '/bin/login -H -- \u'

After the change --nohostname behaves similar way with --host option, that is when combined with --remote the effect is passed to login(1).

In same go improve manual page a little bit. This includes small mistake in commit 01095ae33c that claimed option -r is added to command line when passing hostname login while it should have been -h.

---
 term-utils/agetty.8 | 27 +++++++++++++++++----------
 term-utils/agetty.c |  9 ++++++---
 2 files changed, 23 insertions(+), 13 deletions(-)
Quoted 10 lines

term-utils/agetty.8 Assume that the tty is 8-bit clean, hence disable parity detection. · line 92

Quoted 8 lines
term-utils/agetty.8 +0 -0
index 40be8b46c..bdb1a7d35 100644
@@ -90,18 +90,22 @@ Assume that the tty is 8-bit clean, hence disable parity detection.
 .TP
 \-a, \-\-autologin \fIusername\fP
 Log the specified user automatically in without asking for a login name and

Hey Sami, since you're here you might want to fix this too?

Hi JWP,

Let me split the change in two:

1. --nohostname option forward + minimal manual change
2. manual page update

Karel, please hold on with these three changes. I will push changes to a some branch in my git and tell when the stuff is fast forwardable.

Signature · 2 lines
Sami Kerola
http://www.iki.fi/kerolasa/
#5 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

Quoted 6 lines · Sami Kerola
Quoted 2 lines · J William Piggott

Hey Sami, since you're here you might want to fix this too?

Hi JWP,

Quoted 7 lines

Let me split the change in two:

1. --nohostname option forward + minimal manual change
2. manual page update

Karel, please hold on with these three changes. I will push changes to a some branch in my git and tell when the stuff is fast forwardable.

Here are the updated changes, first one is the minimal option forwarding and second tries to make manual page better.

https://github.com/kerolasa/lelux-utiliteetit/commit/343cc275591327bc2094f88387f09702a542dc8c
https://github.com/kerolasa/lelux-utiliteetit/commit/c9151874b67a652b7095243fde2203ab8cd7d107

Branch name is: 2017wk13

Signature · 2 lines
Sami Kerola
http://www.iki.fi/kerolasa/
#6 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

I don't understand this:

8< ---

-o, --login-options "/path/command --option argument -- \u"
Options that are passed to the login program. \u is replaced
by the login name. The default is "/bin/login -- \u".
8< ---

Is this saying the argument must include the login command? Is that what "/path/command" represents? If yes, then the second line is incorrect. If no, then the last sentence is incorrect.

Quoted 23 lines · Sami Kerola
Quoted 6 lines · Sami Kerola
Quoted 2 lines · J William Piggott

Hey Sami, since you're here you might want to fix this too?

Hi JWP,

Quoted 7 lines

Let me split the change in two:

1. --nohostname option forward + minimal manual change
2. manual page update

Karel, please hold on with these three changes. I will push changes to a some branch in my git and tell when the stuff is fast forwardable.

Here are the updated changes, first one is the minimal option forwarding and second tries to make manual page better.

https://github.com/kerolasa/lelux-utiliteetit/commit/343cc275591327bc2094f88387f09702a542dc8c
https://github.com/kerolasa/lelux-utiliteetit/commit/c9151874b67a652b7095243fde2203ab8cd7d107

Branch name is: 2017wk13

maintainer
#7 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

Quoted 5 lines · J William Piggott

I don't understand this:

8< ---

Quoted 8 lines

-o, --login-options "/path/command --option argument -- \u"
Options that are passed to the login program. \u is replaced
by the login name. The default is "/bin/login -- \u".
8< ---

Is this saying the argument must include the login command? Is that what "/path/command" represents? If yes, then the second line is incorrect. If no, then the last sentence is incorrect.

from code:

    login_argv[login_argc++] = options.login; 
    ...

    login_options_to_argv(login_argv, &login_argc,
                        options.logopt, username);
    ...
    execv(options.login, login_argv);

where:

    options.login is --login-program
    login-options is --login-options

so the man page is wrong, --login-options should be without the path.

I'll fix it.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#8 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

Quoted 26 lines · Karel Zak
Quoted 5 lines · J William Piggott

I don't understand this:

8< ---

Quoted 8 lines

-o, --login-options "/path/command --option argument -- \u"
Options that are passed to the login program. \u is replaced
by the login name. The default is "/bin/login -- \u".
8< ---

Is this saying the argument must include the login command? Is that what "/path/command" represents? If yes, then the second line is incorrect. If no, then the last sentence is incorrect.

from code:

    login_argv[login_argc++] = options.login; 
    ...

    login_options_to_argv(login_argv, &login_argc,
                        options.logopt, username);
    ...
    execv(options.login, login_argv);
Quoted 7 lines

where:

    options.login is --login-program
    login-options is --login-options

so the man page is wrong, --login-options should be without the path.

I'll fix it.

The man-page quote is from Sami's working branch (which I'm reviewing).

PS It looks like your email didn't make it to the list for some reason.

Quoted 3 lines

Karel

#9 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

In reply to Sami Kerola
Quoted 15 lines · Sami Kerola
Quoted 6 lines · Sami Kerola
Quoted 2 lines · J William Piggott

Hey Sami, since you're here you might want to fix this too?

Hi JWP,

Quoted 7 lines

Let me split the change in two:

1. --nohostname option forward + minimal manual change
2. manual page update

Karel, please hold on with these three changes. I will push changes to a some branch in my git and tell when the stuff is fast forwardable.

Quoted 8 lines

Here are the updated changes, first one is the minimal option forwarding and second tries to make manual page better.

https://github.com/kerolasa/lelux-utiliteetit/commit/343cc275591327bc2094f88387f09702a542dc8c
https://github.com/kerolasa/lelux-utiliteetit/commit/c9151874b67a652b7095243fde2203ab8cd7d107

Branch name is: 2017wk13

Sami,

Rather than trying to comment on all of your changes, I'm submitting my suggestions via the attached patch. It applies over your 2017wk13 branch.

I changed --login-options according to Karel's comments. Please check that I understood him correctly. Instead of trying to illustrate it's use in the replaceable argument, I moved it to an example.

I added some language explaining the purpose of --remote. Please check that I understood that correctly also.

term-utils/agetty.8 +35 -23
index 5477035..23adff3 100644
@@ -89,22 +89,29 @@ or 'hurd' for GNU Hurd on a virtual terminal.
 Assume that the tty is 8-bit clean, hence disable parity detection.
 .TP
 \-a, \-\-autologin \fIusername\fP
-Automatically log in the specified user without asking username or password.
-Use of this option causes \fB\-f \fIusername\fR option and argument to be
-added to the \fB/bin/login\fP command line.  This option can combined with
-\fB\-\-login\-options\fR, and then \\u is replaced by the \fIusername\fR.
+Automatically log in the specified user without asking for a username or password.
+Using this option causes an \fB\-f \fIusername\fR option and argument to be
+added to the \fB/bin/login\fP command line.  See \fB\-\-login\-options\fR, which
+can be used to modify this option's behavior.
 .TP
 \-c, \-\-noreset
 Do not reset terminal cflags (control modes).  See \fBtermios\fP(3) for more
 details.
 .TP
 \-E, \-\-remote
+Typically the \fBlogin\fP(1) command is given a remote hostname when
+called by something such as \fBtelnetd\fP(8).  This option allows \fBagetty\fP
+to pass what it is using for a hostname to \fBlogin\fP(1) for use
+in \fButmp\fP(5).  See \fB\-\-host\fP, \fBlogin\fP(1), and \fButmp\fP(5).
+.IP
 If the \fB\-\-host\fP \fIfakehost\fP option is given, then an \fB\-h\fP
 \fIfakehost\fP option and argument are added to the \fB/bin/login\fP
 command line.
 .IP
-If an \fB\-\-nohostname\fR option is given, then an \fB\-H\fP option
+If the \fB\-\-nohostname\fR option is given, then an \fB\-H\fP option
 is added to the \fB/bin/login\fP command line.
+.IP
+See \fB\-\-login\-options\fR.
 .TP
 \-f, \-\-issue\-file \fIissue_file\fP
 Display the contents of \fIissue_file\fP instead of \fI/etc/issue\fP.
@@ -116,8 +123,8 @@ Enable hardware (RTS/CTS) flow control.  It is left up to the
 application to disable software (XON/XOFF) flow protocol where
 appropriate.
 .TP
-\-H, \-\-host \fIlogin_host\fP
-Write the specified \fIlogin_host\fP into the utmp file.  Normally,
+\-H, \-\-host \fIfakehost\fP
+Write the specified \fIfakehost\fP into the utmp file.  Normally,
 no login host is given, since \fBagetty\fP is used for local hardwired
 connections and consoles.  However, this option can be useful for
 identifying terminal concentrators and the like.
@@ -137,12 +144,13 @@ octal 012), write \\012.
 .TP
 \-J, \-\-noclear
 Do not clear the screen before prompting for the login name.
-By default screen is cleared.
+By default the screen is cleared.
 .TP
 \-l, \-\-login\-program \fIlogin_program\fP
 Invoke the specified \fIlogin_program\fP instead of /bin/login.  This allows
-the use of a non-standard login program.  Such program could for example
-ask for a dial-up password or use a different password file.
+the use of a non-standard login program.  Such a program could, for example,
+ask for a dial-up password or use a different password file. See
+\fB\-\-login\-options\fP.
 .TP
 \-L, \-\-local\-line[=\fImode\fP]
 Control the CLOCAL line flag.  The optional \fImode\fP argument is 'auto', 'always' or 'never'.
@@ -192,13 +200,17 @@ program that \fBagetty\fR starts (usually /bin/login) is run as root.
 \-N, \-\-nonewline
 Do not print a newline before writing out /etc/issue.
 .TP
-\-o, \-\-login\-options "\fI/path/command --option argument -- \\u\fP"
-Options  that  are passed to the login program.  \\u is replaced
-by the login name.  The default is "/bin/login -- \\u".
-.IP
-Also see the \fB\-\-autologin\fR and \fB\-\-remote\fR options.
-.IP
+\-o, \-\-login\-options "\fIlogin_options\fP"
+Options  and arguments that  are passed to \fBlogin\fP(1). Where \\u is
+replaced by the login name. For example:
+.RS
+.IP "" 4
+.B "\-\-login\-options '-h darkstar -- \\\u'"
+.PP
+See \fB\-\-autologin\fR, \fB\-\-login\-program\fR and \fB\-\-remote\fR.
+.PP
 Please read the SECURITY NOTICE below before using this option.
+.RE
 .TP
 \-p, \-\-login\-pause
 Wait for any key before dropping to the login prompt.  Can be combined
@@ -226,8 +238,8 @@ Note that this has no support for any Unicode characters.
 .TP
 \-w, \-\-wait\-cr
 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
-and the login prompt.  This is useful with the \-\-init\-string
+linefeed character before sending the \fI/etc/issue\fP file (or others)
+and the login prompt.  This is useful with the \fB\-\-init\-string\fP
 option.
 .TP
 \-\-nohints
@@ -283,7 +295,7 @@ for the other fields.  See \fIinittab(5)\fP for more details.
 For a hardwired line or a console tty:
 
 .RS
-/sbin/agetty 9600 ttyS1
+.B /sbin/agetty\ 9600\ ttyS1
 .RE
 
 For a directly connected terminal without proper carrier-detect wiring
@@ -291,13 +303,13 @@ For a directly connected terminal without proper carrier-detect wiring
 prompt):
 
 .RS
-/sbin/agetty \-\-local\-line 9600 ttyS1 vt100
+.B /sbin/agetty\ \-\-local\-line\ 9600\ ttyS1\ vt100
 .RE
 
 For an old-style dial-in line with a 9600/2400/1200 baud modem:
 
 .RS
-/sbin/agetty \-\-extract\-baud \-\-timeout 60 ttyS1 9600,2400,1200
+.B /sbin/agetty\ \-\-extract\-baud\ \-\-timeout\ 60\ ttyS1\ 9600,2400,1200
 .RE
 
 For a Hayes modem with a fixed 115200 bps interface to the machine
@@ -306,7 +318,7 @@ modem/computer DCD track modem/modem DCD, makes a DTR drop cause a
 disconnection, and turns on auto-answer after 1 ring):
 
 .RS
-/sbin/agetty \-\-wait\-cr \-\-init\-string 'ATE0Q1&D2&C1S0=1\\015' 115200 ttyS1
+.B /sbin/agetty\ \-\-wait\-cr\ \-\-init\-string\ 'ATE0Q1&D2&C1S0=1\\015'\ 115200\ ttyS1
 .RE
 
 .SH SECURITY NOTICE
@@ -394,7 +406,7 @@ Insert the string "1 user" or "<n> users" where <n> is the number of current
 users logged in.
 .TP
 v
-Insert the version of the OS, that is the build-date and such.
+Insert the version of the OS, that is, the build-date and such.
 .PP
 An example.  On my system, the following \fI/etc/issue\fP file:
 .sp
maintainer
#10 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

Quoted 31 lines · J William Piggott
Quoted 15 lines · Sami Kerola
Quoted 6 lines · Sami Kerola
Quoted 2 lines · J William Piggott

Hey Sami, since you're here you might want to fix this too?

Hi JWP,

Quoted 7 lines

Let me split the change in two:

1. --nohostname option forward + minimal manual change
2. manual page update

Karel, please hold on with these three changes. I will push changes to a some branch in my git and tell when the stuff is fast forwardable.

Quoted 8 lines

Here are the updated changes, first one is the minimal option forwarding and second tries to make manual page better.

https://github.com/kerolasa/lelux-utiliteetit/commit/343cc275591327bc2094f88387f09702a542dc8c
https://github.com/kerolasa/lelux-utiliteetit/commit/c9151874b67a652b7095243fde2203ab8cd7d107

Branch name is: 2017wk13

Sami,

Rather than trying to comment on all of your changes, I'm submitting my suggestions via the attached patch. It applies over your 2017wk13 branch.

Quoted 6 lines

I changed --login-options according to Karel's comments. Please check that I understood him correctly. Instead of trying to illustrate it's use in the replaceable argument, I moved it to an example.

I added some language explaining the purpose of --remote. Please check that I understood that correctly also.

Can you use master branch? Sami's patches are already merged and I did some changes to the man page too.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#11 lore raw

PATCH 1/1 agetty: various man-page fixes

term-utils/agetty.8

---

Quoted 6 lines · Karel Zak

Can you use master branch? Sami's patches are already merged and I did some changes to the man page too.

Karel

Sorry, I didn't know you merged it already.

 term-utils/agetty.8 | 60 ++++++++++++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 24 deletions(-)
term-utils/agetty.8 +36 -24
index 9560c1f..23adff3 100644
@@ -89,22 +89,29 @@ or 'hurd' for GNU Hurd on a virtual terminal.
 Assume that the tty is 8-bit clean, hence disable parity detection.
 .TP
 \-a, \-\-autologin \fIusername\fP
-Automatically log in the specified user without asking username or password.
-Use of this option causes \fB\-f \fIusername\fR option and argument to be
-added to the \fB/bin/login\fP command line.  This option can combined with
-\fB\-\-login\-options\fR, and then \\u is replaced by the \fIusername\fR.
+Automatically log in the specified user without asking for a username or password.
+Using this option causes an \fB\-f \fIusername\fR option and argument to be
+added to the \fB/bin/login\fP command line.  See \fB\-\-login\-options\fR, which
+can be used to modify this option's behavior.
 .TP
 \-c, \-\-noreset
 Do not reset terminal cflags (control modes).  See \fBtermios\fP(3) for more
 details.
 .TP
 \-E, \-\-remote
+Typically the \fBlogin\fP(1) command is given a remote hostname when
+called by something such as \fBtelnetd\fP(8).  This option allows \fBagetty\fP
+to pass what it is using for a hostname to \fBlogin\fP(1) for use
+in \fButmp\fP(5).  See \fB\-\-host\fP, \fBlogin\fP(1), and \fButmp\fP(5).
+.IP
 If the \fB\-\-host\fP \fIfakehost\fP option is given, then an \fB\-h\fP
 \fIfakehost\fP option and argument are added to the \fB/bin/login\fP
 command line.
 .IP
-If an \fB\-\-nohostname\fR option is given, then an \fB\-H\fP option
+If the \fB\-\-nohostname\fR option is given, then an \fB\-H\fP option
 is added to the \fB/bin/login\fP command line.
+.IP
+See \fB\-\-login\-options\fR.
 .TP
 \-f, \-\-issue\-file \fIissue_file\fP
 Display the contents of \fIissue_file\fP instead of \fI/etc/issue\fP.
@@ -116,8 +123,8 @@ Enable hardware (RTS/CTS) flow control.  It is left up to the
 application to disable software (XON/XOFF) flow protocol where
 appropriate.
 .TP
-\-H, \-\-host \fIlogin_host\fP
-Write the specified \fIlogin_host\fP into the utmp file.  Normally,
+\-H, \-\-host \fIfakehost\fP
+Write the specified \fIfakehost\fP into the utmp file.  Normally,
 no login host is given, since \fBagetty\fP is used for local hardwired
 connections and consoles.  However, this option can be useful for
 identifying terminal concentrators and the like.
@@ -137,12 +144,13 @@ octal 012), write \\012.
 .TP
 \-J, \-\-noclear
 Do not clear the screen before prompting for the login name.
-By default screen is cleared.
+By default the screen is cleared.
 .TP
 \-l, \-\-login\-program \fIlogin_program\fP
 Invoke the specified \fIlogin_program\fP instead of /bin/login.  This allows
-the use of a non-standard login program.  Such program could for example
-ask for a dial-up password or use a different password file.
+the use of a non-standard login program.  Such a program could, for example,
+ask for a dial-up password or use a different password file. See
+\fB\-\-login\-options\fP.
 .TP
 \-L, \-\-local\-line[=\fImode\fP]
 Control the CLOCAL line flag.  The optional \fImode\fP argument is 'auto', 'always' or 'never'.
@@ -192,13 +200,17 @@ program that \fBagetty\fR starts (usually /bin/login) is run as root.
 \-N, \-\-nonewline
 Do not print a newline before writing out /etc/issue.
 .TP
-\-o, \-\-login\-options \fIoptions\fP
-Options  that  are passed to the login program.  \\u is replaced
-by the user name.  The default is "-- \\u".
-.IP
-Also see the \fB\-\-login\-program\fR, \fB\-\-autologin\fR and \fB\-\-remote\fR options.
-.IP
-Please, read the SECURITY NOTICE below before using this option.
+\-o, \-\-login\-options "\fIlogin_options\fP"
+Options  and arguments that  are passed to \fBlogin\fP(1). Where \\u is
+replaced by the login name. For example:
+.RS
+.IP "" 4
+.B "\-\-login\-options '-h darkstar -- \\\u'"
+.PP
+See \fB\-\-autologin\fR, \fB\-\-login\-program\fR and \fB\-\-remote\fR.
+.PP
+Please read the SECURITY NOTICE below before using this option.
+.RE
 .TP
 \-p, \-\-login\-pause
 Wait for any key before dropping to the login prompt.  Can be combined
@@ -226,8 +238,8 @@ Note that this has no support for any Unicode characters.
 .TP
 \-w, \-\-wait\-cr
 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
-and the login prompt.  This is useful with the \-\-init\-string
+linefeed character before sending the \fI/etc/issue\fP file (or others)
+and the login prompt.  This is useful with the \fB\-\-init\-string\fP
 option.
 .TP
 \-\-nohints
@@ -283,7 +295,7 @@ for the other fields.  See \fIinittab(5)\fP for more details.
 For a hardwired line or a console tty:
 
 .RS
-/sbin/agetty 9600 ttyS1
+.B /sbin/agetty\ 9600\ ttyS1
 .RE
 
 For a directly connected terminal without proper carrier-detect wiring
@@ -291,13 +303,13 @@ For a directly connected terminal without proper carrier-detect wiring
 prompt):
 
 .RS
-/sbin/agetty \-\-local\-line 9600 ttyS1 vt100
+.B /sbin/agetty\ \-\-local\-line\ 9600\ ttyS1\ vt100
 .RE
 
 For an old-style dial-in line with a 9600/2400/1200 baud modem:
 
 .RS
-/sbin/agetty \-\-extract\-baud \-\-timeout 60 ttyS1 9600,2400,1200
+.B /sbin/agetty\ \-\-extract\-baud\ \-\-timeout\ 60\ ttyS1\ 9600,2400,1200
 .RE
 
 For a Hayes modem with a fixed 115200 bps interface to the machine
@@ -306,7 +318,7 @@ modem/computer DCD track modem/modem DCD, makes a DTR drop cause a
 disconnection, and turns on auto-answer after 1 ring):
 
 .RS
-/sbin/agetty \-\-wait\-cr \-\-init\-string 'ATE0Q1&D2&C1S0=1\\015' 115200 ttyS1
+.B /sbin/agetty\ \-\-wait\-cr\ \-\-init\-string\ 'ATE0Q1&D2&C1S0=1\\015'\ 115200\ ttyS1
 .RE
 
 .SH SECURITY NOTICE
@@ -394,7 +406,7 @@ Insert the string "1 user" or "<n> users" where <n> is the number of current
 users logged in.
 .TP
 v
-Insert the version of the OS, that is the build-date and such.
+Insert the version of the OS, that is, the build-date and such.
 .PP
 An example.  On my system, the following \fI/etc/issue\fP file:
 .sp
maintainer Applied
#12 lore raw

Re: [PATCH] agetty: various man-page fixes

Quoted 2 lines · J William Piggott
 term-utils/agetty.8 | 60 ++++++++++++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 24 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer
#13 lore raw

Re: [PATCH 3/3] agetty: make --remote to forward --nohostname as -H to login

In reply to Sami Kerola
Quoted 2 lines · Sami Kerola

+.IP
+If an \fB\-\-nohost\fR option is given, then an \fB\-H\fP option

                ^^^^^^

The name of the option is --nohostname

term-utils/agetty.c int main(int argc, char **argv) · line 501

Quoted 10 lines
term-utils/agetty.c +6 -3
 	} else {
-		if (fakehost && (options.flags & F_REMOTE)) {
-			login_argv[login_argc++] = "-h";
-			login_argv[login_argc++] = fakehost;
+		if (options.flags & F_REMOTE) {
+			if (fakehost) {
+				login_argv[login_argc++] = "-h";
+				login_argv[login_argc++] = fakehost;
+			} else if (options.flags & F_NOHOSTNAME)
+				login_argv[login_argc++] = "-H";

Seems good.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com