aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-24 16:21:24 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-24 23:35:30 +0100
commitcad65de2a9a9b7d29b98f0d2997772c057f92e29 (patch)
treef3ad209f389acb6499cd3b352e061fe730daa760 /include
parent87713e563f0005553f8d075d3839d3960d7f17cb (diff)
Provide Musl derived fallbacks for getopt/getopt_long/getsubopt
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/compat.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/compat.h b/include/compat.h
index e5785d3..8a2522e 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -181,6 +181,31 @@ void w32_perror(const char *str);
char *strndup(const char *str, size_t max_len);
#endif
+#ifndef HAVE_GETOPT
+extern char *optarg;
+extern int optind, opterr, optopt, optpos, optreset;
+
+void __getopt_msg(const char *a, const char *b, const char *c, size_t l);
+
+int getopt(int argc, char * const argv[], const char *optstring);
+#endif
+
+#ifndef HAVE_GETOPT_LONG
+struct option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+int getopt_long(int, char *const *, const char *,
+ const struct option *, int *);
+#endif
+
#ifndef HAVE_GETSUBOPT
int getsubopt(char **opt, char *const *keys, char **val);
#endif