coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] md5sum,b2sum,sha*sum: support -s option


From: Carlos Santos
Subject: [PATCH] md5sum,b2sum,sha*sum: support -s option
Date: Mon, 25 Jun 2018 00:00:37 -0300

Add an alias to --status matching the "-s" option recognized by BusyBox.
It helps to interchange scripts between full-fledged Linux distributions
and embedded systems on which BusyBox is used instead of coreutils.

* doc/coreutils.texi (md5sum invocation): Describe the new option as an
  alias for --status.
* src/md5sum.c: Add the new optio an the corresponding help finrmation.
* NEWS: Mention the new option.
---
 NEWS               |  5 +++++
 doc/coreutils.texi |  4 +++-
 src/md5sum.c       | 11 +++++------
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index f326ba2bb..e5ed4fd18 100644
--- a/NEWS
+++ b/NEWS
@@ -59,6 +59,11 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   string into multiple arguments. Used to pass multiple arguments in scripts
   (shebang lines).
 
+  md5sum accepts a new option: -s, an alias to --status matching the "-s"
+  option recognized by BusyBox.  It helps to interchange scripts between
+  full-fledged Linux distributions and embedded systems on which BusyBox is
+  used instead of coreutils.
+
   md5sum accepts a new option: --zero (-z) to delimit the output lines with a
   NUL instead of a newline character.  This also disables file name escaping.
   This also applies to sha*sum and b2sum.
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 9ac82f887..d84108dba 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3932,7 +3932,9 @@ checked file.  Files that fail the verification are 
reported in the
 default one-line-per-file format.  If there is any checksum mismatch,
 print a warning summarizing the failures to standard error.
 
-@item --status
+@item -s
+@itemx --status
+@opindex -s
 @opindex --status
 @cindex verifying MD5 checksums
 This option is useful only when verifying checksums.
diff --git a/src/md5sum.c b/src/md5sum.c
index e41fb24be..3ad5368a0 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -193,7 +193,6 @@ static uintmax_t blake2_max_len[]=
 enum
 {
   IGNORE_MISSING_OPTION = CHAR_MAX + 1,
-  STATUS_OPTION,
   QUIET_OPTION,
   STRICT_OPTION,
   TAG_OPTION
@@ -208,7 +207,7 @@ static struct option const long_options[] =
   { "check", no_argument, NULL, 'c' },
   { "ignore-missing", no_argument, NULL, IGNORE_MISSING_OPTION},
   { "quiet", no_argument, NULL, QUIET_OPTION },
-  { "status", no_argument, NULL, STATUS_OPTION },
+  { "status", no_argument, NULL, 's' },
   { "text", no_argument, NULL, 't' },
   { "warn", no_argument, NULL, 'w' },
   { "strict", no_argument, NULL, STRICT_OPTION },
@@ -275,7 +274,7 @@ Print or check %s (%d-bit) checksums.\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\
+      -s, --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\
@@ -883,10 +882,10 @@ main (int argc, char **argv)
   setvbuf (stdout, NULL, _IOLBF, 0);
 
 #if HASH_ALGO_BLAKE2
-  const char* short_opts = "l:bctwz";
+  const char* short_opts = "l:bcstwz";
   const char* b2_length_str = "";
 #else
-  const char* short_opts = "bctwz";
+  const char* short_opts = "bcstwz";
 #endif
 
   while ((opt = getopt_long (argc, argv, short_opts, long_options, NULL)) != 
-1)
@@ -910,7 +909,7 @@ main (int argc, char **argv)
       case 'c':
         do_check = true;
         break;
-      case STATUS_OPTION:
+      case 's':
         status_only = true;
         warn = false;
         quiet = false;
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]