From 7c73a3b047b24c0fb28102c966a42b6ab523a052 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Mon, 1 Mar 2004 21:20:57 +0100
Subject: [PATCH] * testsuite/des-compat-test.c: Don't include <unistd.h>.

* 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 |  1 -
 testsuite/testutils.c       | 30 ++++++++++--------------------
 2 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/testsuite/des-compat-test.c b/testsuite/des-compat-test.c
index a06fb6ae..b2c70b03 100644
--- a/testsuite/des-compat-test.c
+++ b/testsuite/des-compat-test.c
@@ -58,7 +58,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 
 #include "des-compat.h"
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
index 6b2e5487..7ea750ad 100644
--- a/testsuite/testutils.c
+++ b/testsuite/testutils.c
@@ -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();
 }
-- 
GitLab