]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
* testsuite/des-compat-test.c: Don't include <unistd.h>.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 1 Mar 2004 20:20:57 +0000 (21:20 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 1 Mar 2004 20:20:57 +0000 (21:20 +0100)
* testsuite/testutils.c (main): Don't use getopt. Then we don't
need to include <unistd.h>.

Rev: src/nettle/testsuite/des-compat-test.c:1.6
Rev: src/nettle/testsuite/testutils.c:1.26

testsuite/des-compat-test.c
testsuite/testutils.c

index a06fb6aef3d91056ebed5a7530279ca5000d9007..b2c70b034e4deecb80b8ceff14c91c8ad8e1a4f9 100644 (file)
@@ -58,7 +58,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 
 #include "des-compat.h"
index 6b2e548789ce01925253d2e9fc4fca705f281fad..7ea750ad2fdfa93667fe925d0ddb1d6fbcf8f6fc 100644 (file)
@@ -10,9 +10,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-/* For getopt() */
-#include <unistd.h>
-
 /* -1 means invalid */
 static const signed char hex_digits[0x100] =
   {
@@ -147,24 +144,17 @@ int verbose = 0;
 int
 main(int argc, char **argv)
 {
-  int c;
-
-  while ((c = getopt (argc, argv, "v")) != -1)
-    switch (c)
-      {
-      case 'v':
+  if (argc > 1)
+    {
+      if (argc == 2 && strcmp(argv[1], "-v"))
        verbose = 1;
-       break;
-      case '?':
-       if (isprint (optopt))
-         fprintf (stderr, "Unknown option `-%c'.\n", optopt);
-       else
-         fprintf (stderr,
-                  "Unknown option character `\\x%x'.\n",
-                  optopt);
-      default:
-       abort();
-      }
+      else
+       {
+         fprintf(stderr, "Invalid argument `%s', only accepted option is `-v'.\n",
+                 argv[1]);
+         return 1;
+       }
+    }
 
   return test_main();
 }