[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: md5sum minor cleanup
From: |
Paul Eggert |
Subject: |
Re: md5sum minor cleanup |
Date: |
Sun, 19 Sep 2004 09:56:40 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Jim Meyering <address@hidden> writes:
>> I notice that md5sum's --string option isn't documented; is this
>> intentional?
>
> It may be safely removed, now :-)
Goody, I love removing code. :-)
I installed this:
2004-09-19 Paul Eggert <address@hidden>
* src/md5sum.c (STRING_OPTION): Remove.
(long_options, main): Remove support for undocumented and
obsolete --string option, as suggested in the 1996-09-26 patch.
* NEWS: Document this.
Index: NEWS
===================================================================
RCS file: /home/eggert/coreutils/cu/NEWS,v
retrieving revision 1.234
diff -p -u -r1.234 NEWS
--- NEWS 10 Sep 2004 20:53:53 -0000 1.234
+++ NEWS 19 Sep 2004 16:52:06 -0000
@@ -222,6 +222,8 @@ GNU coreutils NEWS
** Removed features
+ md5sum and sha1sum's undocumented --string option has been removed.
+
tail's undocumented --max-consecutive-size-changes option has been removed.
* Major changes in release 5.2.1 (2004-03-12) [stable]
Index: src/md5sum.c
===================================================================
RCS file: /home/eggert/coreutils/cu/src/md5sum.c,v
retrieving revision 1.127
diff -p -u -r1.127 md5sum.c
--- src/md5sum.c 19 Sep 2004 02:21:09 -0000 1.127
+++ src/md5sum.c 19 Sep 2004 16:47:48 -0000
@@ -105,8 +105,7 @@ char *program_name;
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
- STATUS_OPTION = CHAR_MAX + 1,
- STRING_OPTION
+ STATUS_OPTION = CHAR_MAX + 1
};
static const struct option long_options[] =
@@ -114,7 +113,6 @@ static const struct option long_options[
{ "binary", no_argument, 0, 'b' },
{ "check", no_argument, 0, 'c' },
{ "status", no_argument, 0, STATUS_OPTION },
- { "string", required_argument, 0, STRING_OPTION },
{ "text", no_argument, 0, 't' },
{ "warn", no_argument, 0, 'w' },
{ GETOPT_HELP_OPTION_DECL },
@@ -558,8 +556,6 @@ main (int argc, char **argv)
unsigned char bin_buffer[MAX_DIGEST_BIN_BYTES];
bool do_check = false;
int opt;
- char **string = NULL;
- size_t n_strings = 0;
bool ok = true;
bool file_type_specified = false;
@@ -584,13 +580,6 @@ main (int argc, char **argv)
while ((opt = getopt_long (argc, argv, "bctw", long_options, NULL)) != -1)
switch (opt)
{
- case STRING_OPTION:
- {
- if (string == NULL)
- string = xnmalloc (argc - 1, sizeof *string);
- string[n_strings++] = optarg;
- }
- break;
case 'b':
file_type_specified = true;
binary = true;
@@ -626,13 +615,6 @@ main (int argc, char **argv)
usage (EXIT_FAILURE);
}
- if (n_strings > 0 && do_check)
- {
- error (0, 0,
- _("the --string and --check options are mutually exclusive"));
- usage (EXIT_FAILURE);
- }
-
if (status_only & !do_check)
{
error (0, 0,
@@ -647,32 +629,7 @@ main (int argc, char **argv)
usage (EXIT_FAILURE);
}
- if (n_strings > 0)
- {
- size_t i;
-
- if (optind < argc)
- {
- error (0, 0, _("extra operand %s"), quote (argv[optind]));
- fprintf (stderr, "%s\n",
- _("File operands cannot be combined with --string."));
- usage (EXIT_FAILURE);
- }
- for (i = 0; i < n_strings; ++i)
- {
- size_t cnt;
- if (algorithm == ALG_MD5)
- md5_buffer (string[i], strlen (string[i]), bin_buffer);
- else
- sha1_buffer (string[i], strlen (string[i]), bin_buffer);
-
- for (cnt = 0; cnt < (digest_hex_bytes / 2); ++cnt)
- printf ("%02x", bin_buffer[cnt]);
-
- printf (" \"%s\"\n", string[i]);
- }
- }
- else if (do_check)
+ if (do_check)
{
if (optind + 1 < argc)
{