(STRING_OPTION): Remove.
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 19 Sep 2004 16:52:50 +0000 (16:52 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 19 Sep 2004 16:52:50 +0000 (16:52 +0000)
(long_options, main): Remove support for undocumented and
obsolete --string option, as suggested in the 1996-09-26 patch.

src/md5sum.c

index 9a9bdb2..d2efd5e 100644 (file)
@@ -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)
        {