From 3d997c941819dd1b7aaa2c56859eff9edab2d83f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 27 Jun 2025 14:04:07 +0200 Subject: [PATCH] script: (man,usage) correct the markup of the synopsis 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 Signed-off-by: Benno Schulenberg --- 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..1bff42457 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] [] [-- [...]]\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 run command rather than interactive shell\n" - " (alternative to '-- program [arguments]')\n"), out); + fputs(_(" -c, --command run rather than an interactive shell\n" + " (alternative to '-- []')\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.39.5