From d76eb9dd46081279642d3353f51ebc09fe4bbe9f Mon Sep 17 00:00:00 2001
From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Date: Thu, 2 Apr 2020 20:03:32 +0200
Subject: Add a libcompat implementation of getopt

Limited to the subset actually needed. Vaguely inspired by the NetBSD
libc implementation.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
---
 include/compat.h | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'include')

diff --git a/include/compat.h b/include/compat.h
index 5d7a052..6f8a77d 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -197,6 +197,13 @@ char *strndup(const char *str, size_t max_len);
 int getsubopt(char **opt, char *const *keys, char **val);
 #endif
 
+#ifndef HAVE_GETOPT
+extern int optind;
+extern char *optarg;
+
+int getopt(int argc, char *const argv[], const char *optstr);
+#endif
+
 #if defined(_WIN32) || defined(__WINDOWS__)
 WCHAR *path_to_windows(const char *input);
 #endif
-- 
cgit v1.2.3