On 20/09/2021 11:03, Pádraig Brady wrote:
On 18/09/2021 17:34, Jim Meyering wrote:
I didn't see an explanation for the single quotes in cksum --help, so
propose to remove them as unnecessary syntax.
Fair enough. We should probably also remove the quotes from usage() in tee.c
Also, IMHO, you should now be listed as a coauthor of the umbrella
"cksum" program.
+1
That got me looking at usage(), which needed a few other improvements.
I'll apply the attached on top.
cheers,
Pádraig
>From 4a89d68ce6e823995bcff0648a809c588f3bf830 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Mon, 20 Sep 2021 13:56:39 +0100
Subject: [PATCH] doc: fix --help formatting for checksum utils
* src/digest.c (usage): Indicate that --length and --algorithm
require arguments. Emit corresponding emit_mandatory_arg_note().
Use consistent alignment.
---
src/digest.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/digest.c b/src/digest.c
index 9398a133e..c30f057b0 100644
--- a/src/digest.c
+++ b/src/digest.c
@@ -424,10 +424,13 @@ Print or check %s (%d-bit) checksums.\n\
-s, --sysv use System V sum algorithm, use 512 bytes blocks\n\
"), stdout);
#endif
+#if HASH_ALGO_BLAKE2 || HASH_ALGO_CKSUM
+ emit_mandatory_arg_note ();
+#endif
#if HASH_ALGO_CKSUM
fputs (_("\
\n\
- -a, --algorithm select the digest mode to operate in. See DIGEST below.\
+ -a, --algorithm=TYPE select the digest type to use. See DIGEST below.\
\n\
"), stdout);
#endif
@@ -435,59 +438,60 @@ Print or check %s (%d-bit) checksums.\n\
# if !HASH_ALGO_CKSUM
if (O_BINARY)
fputs (_("\
- -b, --binary read in binary mode (default unless reading tty stdin)\n\
+ -b, --binary read in binary mode (default unless reading tty stdin)\
+\n\
"), stdout);
else
fputs (_("\
- -b, --binary read in binary mode\n\
+ -b, --binary read in binary mode\n\
"), stdout);
# endif
fputs (_("\
- -c, --check read checksums from the FILEs and check them\n\
+ -c, --check read checksums from the FILEs and check them\n\
"), stdout);
# if HASH_ALGO_BLAKE2 || HASH_ALGO_CKSUM
fputs (_("\
- -l, --length digest length in bits; must not exceed the maximum for\n\
- the blake2 algorithm and must be a multiple of 8\n\
+ -l, --length=BITS digest length in bits; must not exceed the max for\n\
+ the blake2 algorithm and must be a multiple of 8\n\
"), stdout);
# endif
# if HASH_ALGO_CKSUM
fputs (_("\
- --untagged create a reversed style checksum, without digest type\n\
+ --untagged create a reversed style checksum, without digest type\n\
"), stdout);
# else
fputs (_("\
- --tag create a BSD-style checksum\n\
+ --tag create a BSD-style checksum\n\
"), stdout);
# endif
# if !HASH_ALGO_CKSUM
if (O_BINARY)
fputs (_("\
- -t, --text read in text mode (default if reading tty stdin)\n\
+ -t, --text read in text mode (default if reading tty stdin)\n\
"), stdout);
else
fputs (_("\
- -t, --text read in text mode (default)\n\
+ -t, --text read in text mode (default)\n\
"), stdout);
# endif
fputs (_("\
- -z, --zero end each output line with NUL, not newline,\n\
- and disable file name escaping\n\
+ -z, --zero end each output line with NUL, not newline,\n\
+ and disable file name escaping\n\
"), stdout);
fputs (_("\
\n\
The following five options are useful only when verifying checksums:\n\
--ignore-missing don't fail or report status for missing files\n\
- --quiet don't print OK for each successfully verified file\n\
- --status don't output anything, status code shows success\n\
- --strict exit non-zero for improperly formatted checksum lines\n\
- -w, --warn warn about improperly formatted checksum lines\n\
+ --quiet don't print OK for each successfully verified file\n\
+ --status don't output anything, status code shows success\n\
+ --strict exit non-zero for improperly formatted checksum lines\n\
+ -w, --warn warn about improperly formatted checksum lines\n\
\n\
"), stdout);
#endif
#if HASH_ALGO_CKSUM
fputs (_("\
- --debug indicate which implementation used\n\
+ --debug indicate which implementation used\n\
"), stdout);
#endif
fputs (HELP_OPTION_DESCRIPTION, stdout);
--
2.26.2