From 89ea90fae83d1a0262876a24ba748bf808437dc0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Tue, 20 Jan 2026 14:07:01 +0000 Subject: [PATCH] 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. --- src/cksum.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cksum.c b/src/cksum.c index c6e4378589..3abc71dcad 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.47.3