cksum: use more accurate program name in single binary mode

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.
This commit is contained in:
Pádraig Brady committed 2026-01-21 13:50:37 +00:00
1 parent a96abcbbeb
commit 89ea90fae8
1 file changed
+11 -1
+11 -1
View File
@@ -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"), \