32 lines
934 B
Text
32 lines
934 B
Text
$NetBSD: patch-ag,v 1.2 2007/11/15 06:36:46 rillig Exp $
|
|
|
|
--- commandline.cpp.orig 2000-01-12 09:31:50.000000000 +0100
|
|
+++ commandline.cpp 2007-11-15 06:51:09.407141000 +0100
|
|
@@ -1,6 +1,18 @@
|
|
#include <cstdlib>
|
|
|
|
#define _GNU_SOURCE
|
|
+
|
|
+// If either _POSIX_SOURCE or _XOPEN_SOURCE are defined
|
|
+// then the libgetopt getopt.h will skip defining
|
|
+// struct option (for getopt_long)
|
|
+#ifdef _POSIX_SOURCE
|
|
+#undef _POSIX_SOURCE
|
|
+#endif
|
|
+
|
|
+#ifdef _XOPEN_SOURCE
|
|
+#undef _XOPEN_SOURCE
|
|
+#endif
|
|
+
|
|
#include <getopt.h>
|
|
|
|
#include "commandline.h"
|
|
@@ -35,7 +47,7 @@ Commandline::parse (int argc, char *argv
|
|
int c, j, option_index;
|
|
|
|
for (i = OptionsByName.begin (), j = 0; i != OptionsByName.end (); i++, j++) {
|
|
- lopts[j].name = i->second->name.c_str ();
|
|
+ lopts[j].name = const_cast<char *>(i->second->name.c_str ());
|
|
lopts[j].has_arg = i->second->argument;
|
|
lopts[j].flag = 0;
|
|
lopts[j].val = i->second->shortop;
|