[PATCH 1/2] script: (man,usage) correct the markup of the synopsis

Benno Schulenberg <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Also, use the word "command", to match the wording for the --command
option, and improve the wording of the description of that option.

This fixes 7268e79bc5.

CC: WanBingjiang <[email protected]>
Signed-off-by: Benno Schulenberg <[email protected]>
---
 term-utils/script.1.adoc | 5 +++--
 term-utils/script.c      | 8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/term-utils/script.1.adoc b/term-utils/script.1.adoc
index 688ec5e2d..b4bec0c02 100644
--- a/term-utils/script.1.adoc
+++ b/term-utils/script.1.adoc
@@ -49,7 +49,7 @@ script - make typescript of terminal session
 
 == SYNOPSIS
 
-*script* [options] [_file_] [ -- program [arguments]]
+*script* [options] [_file_] [*--* _command_ [_argument_...]]
 
 == DESCRIPTION
 
@@ -69,7 +69,8 @@ Below, the _size_ argument may be followed by the multiplicative suffixes KiB (=
 Append the output to _file_ or to _typescript_, retaining the prior contents.
 
 *-c*, *--command* _command_::
-Run the _command_ rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty. It's possible to specify the command after '--' too.
+Run the _command_ rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty.
+Instead of using option *-c*, the _command_ may also be specified after a double dash (*--*).
 
 *-E*, *--echo* _when_::
 This option controls the *ECHO* flag for the slave end of the session's pseudoterminal. The supported modes are _always_, _never_, or _auto_.
diff --git a/term-utils/script.c b/term-utils/script.c
index 80ea477ab..7ba57a6a6 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -191,7 +191,7 @@ static void __attribute__((__noreturn__)) usage(void)
 {
 	FILE *out = stdout;
 	fputs(USAGE_HEADER, out);
-	fprintf(out, _(" %s [options] [file] [-- program [arguments]]\n"), program_invocation_short_name);
+	fprintf(out, _(" %s [options] [<file>] [-- <command> [<argument>...]]\n"), program_invocation_short_name);
 
 	fputs(USAGE_SEPARATOR, out);
 	fputs(_("Make a typescript of a terminal session.\n"), out);
@@ -208,8 +208,8 @@ static void __attribute__((__noreturn__)) usage(void)
 	fputs(USAGE_SEPARATOR, out);
 
 	fputs(_(" -a, --append                  append to the log file\n"), out);
-	fputs(_(" -c, --command <command>       run command rather than interactive shell\n"
-		"                                 (alternative to '-- program [arguments]')\n"), out);
+	fputs(_(" -c, --command <command>       run <command> rather than an interactive shell\n"
+		"                                 (alternative to '-- <command> [<argument...>]')\n"), out);
 	fputs(_(" -e, --return                  return exit code of the child process\n"), out);
 	fputs(_(" -f, --flush                   run flush after each write\n"), out);
 	fputs(_("     --force                   use output file even when it is a link\n"), out);
@@ -930,7 +930,7 @@ int main(int argc, char **argv)
 	/* concat non-option arguments as command */
 	if (argc > 0 && strcmp(argv[-1], "--") == 0) {
 		if (ctl.command != NULL) {
-			warnx(_("option --command and '-- program' are mutually exclusive"));
+			warnx(_("option --command and a command after '--' cannot be combined"));
 			errtryhelp(EXIT_FAILURE);
 		}
 
-- 
2.48.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.