Following commit v9.9-109-gcd5229222
* src/cksum.c (PROGRAM_NAME): In legacy mode, i.e., when built
as a single binary, set the PROGRAM_NAME dynamically based on
the selected digest type. This is significant in --help
to ensure the correct texinfo node is referenced, and in
--version to ensure the correct utility name is output.
---
src/cksum.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/cksum.c b/src/cksum.c
index 977394eea..bab319bdb 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -77,7 +77,6 @@
#elif HASH_ALGO_CKSUM
# define MAX_DIGEST_BITS 512
# define MAX_DIGEST_ALIGN 8
-# define PROGRAM_NAME "cksum"
# define DIGEST_TYPE_STRING algorithm_tags[cksum_algorithm]
# define DIGEST_STREAM cksumfns[cksum_algorithm]
# define DIGEST_OUT cksum_output_fns[cksum_algorithm]
@@ -139,6 +138,17 @@
# define DIGEST_OUT output_file
#endif
+#if HASH_ALGO_CKSUM
+# define PROGRAM_NAME (!legacy_mode ? "cksum" \
+ : cksum_algorithm == md5 ? "md5sum" \
+ : cksum_algorithm == sha1 ? "sha1sum" \
+ : cksum_algorithm == sha224 ? "sha224sum" \
+ : cksum_algorithm == sha256 ? "sha256sum" \
+ : cksum_algorithm == sha384 ? "sha384sum" \
+ : cksum_algorithm == sha512 ? "sha512sum" \
+ : "cksum")
+#endif
+
#if HASH_ALGO_SUM
# define AUTHORS \
proper_name ("Kayvan Aghaiepour"), \
--
2.52.0