summaryrefslogtreecommitdiffstats
path: root/openbsd-compat/getopt_long.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-05-10 16:28:55 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-05-10 16:28:55 +1000
commitccfdfceacb7e23d1479ed4cc91976c5ac6e23c56 (patch)
tree5d25c5c77c2143c09413e8b3483f5133aebaa5b8 /openbsd-compat/getopt_long.c
parent39332020078aa8fd4fc28e00b336438dc64b0f5a (diff)
- (dtucker) [openbsd-compat/Makefile.in openbsd-compat/getopt.c
openbsd-compat/getopt_long.c regress/modpipe.c] Remove getopt.c, add portability code to getopt_long.c and switch over Makefile and the ugly hack in modpipe.c. Fixes bz#1448.
Diffstat (limited to 'openbsd-compat/getopt_long.c')
-rw-r--r--openbsd-compat/getopt_long.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/openbsd-compat/getopt_long.c b/openbsd-compat/getopt_long.c
index e149fe0a..6b36d067 100644
--- a/openbsd-compat/getopt_long.c
+++ b/openbsd-compat/getopt_long.c
@@ -49,7 +49,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+/* OPENBSD ORIGINAL: lib/libc/stdlib/getopt_long.c */
+#include "includes.h"
+
+#if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_OPTRESET)
+#include "log.h"
+
+/*
+ * Some defines to make it easier to keep the code in sync with upstream.
+ * getopt opterr optind optopt optreset optarg are all in defines.h which is
+ * pulled in by includes.h.
+ */
+#define warnx logit
+
+#if 0
#include <err.h>
+#endif
#include <errno.h>
#include <getopt.h>
#include <stdlib.h>
@@ -484,6 +499,7 @@ getopt(int nargc, char * const *nargv, const char *options)
return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
}
+#if 0
/*
* getopt_long --
* Parse argc/argv argument vector.
@@ -509,3 +525,6 @@ getopt_long_only(int nargc, char * const *nargv, const char *options,
return (getopt_internal(nargc, nargv, options, long_options, idx,
FLAG_PERMUTE|FLAG_LONGONLY));
}
+#endif
+
+#endif /* !defined(HAVE_GETOPT) || !defined(HAVE_OPTRESET) */