getopt_long fix

Dimitrie O. Paun dpaun at rogers.com
Sat Dec 7 10:54:20 CST 2002


ChangeLog
  Gracefully degrade to getopt if getopt_long does not exist.
  (Discovered by Gerald Pfeifer <pfeifer at dbai.tuwien.ac.at>)

Index: configure.ac
===================================================================
RCS file: /var/cvs/wine/configure.ac,v
retrieving revision 1.103
diff -u -r1.103 configure.ac
--- configure.ac	5 Dec 2002 19:19:41 -0000	1.103
+++ configure.ac	7 Dec 2002 16:36:28 -0000
@@ -932,6 +932,7 @@
 	ftruncate64 \
 	getnetbyaddr \
 	getnetbyname \
+	getopt_long \
 	getpagesize \
 	getprotobyname \
 	getprotobynumber \
@@ -980,6 +981,7 @@
 	direct.h \
 	elf.h \
 	float.h \
+	getopt.h \
 	ieeefp.h \
 	io.h \
 	libio.h \
Index: include/config.h.in
===================================================================
RCS file: /var/cvs/wine/include/config.h.in,v
retrieving revision 1.134
diff -u -r1.134 config.h.in
--- include/config.h.in	25 Nov 2002 21:12:26 -0000	1.134
+++ include/config.h.in	7 Dec 2002 16:37:54 -0000
@@ -134,6 +134,12 @@
 /* Define to 1 if you have the `getnetbyname' function. */
 #undef HAVE_GETNETBYNAME
 
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
+
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
Index: include/wine/port.h
===================================================================
RCS file: /var/cvs/wine/include/wine/port.h,v
retrieving revision 1.30
diff -u -r1.30 port.h
--- include/wine/port.h	18 Oct 2002 00:27:38 -0000	1.30
+++ include/wine/port.h	7 Dec 2002 16:43:09 -0000
@@ -158,7 +158,21 @@
 # error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform
 #endif
 
+#ifndef HAVE_GETOPT_LONG
+struct option
+{
+  const char *name;
+  int has_arg; 
+  int *flag; 
+  int val;
+};
 
+int getopt_long(int argc, char * const argv[], const char *optstring,  const struct option *longopts, int *longindex)
+{
+    return getopt(argc, argv, optstring);
+}
+#endif
+    
 /****************************************************************
  * Function definitions (only when using libwine)
  */
Index: tools/wrc/wrc.c
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.c,v
retrieving revision 1.18
diff -u -r1.18 wrc.c
--- tools/wrc/wrc.c	6 Dec 2002 19:49:36 -0000	1.18
+++ tools/wrc/wrc.c	7 Dec 2002 16:35:51 -0000
@@ -59,7 +59,9 @@
 #include <assert.h>
 #include <ctype.h>
 #include <signal.h>
-#include <getopt.h>
+#ifdef HAVE_GETOPT_H
+# include <getopt.h>
+#endif
 
 #include "wrc.h"
 #include "utils.h"


-- 
Dimi.




More information about the wine-patches mailing list