winsup/cygwin/lib/getopt.c -mno-cygwin

Earnie Boyd
Fri Sep 21 06:57:00 GMT 2001

I would like to propose the following patch.  If someone has time to
figure out how to not cause Dr. Watson it would be appreciated.  Else,
the error will live until I can get a round tuit.  This patch allows
getopt.c -mno-cygwin to build and link into strace.
2001-09-21  Earnie Boyd  <>

	* lib/getopt.c (__progname): Handle special case declaration for 

Index: lib/getopt.c
RCS file: /cvs/src/src/winsup/cygwin/lib/getopt.c,v
retrieving revision 1.6
diff -u -3 -p -r1.6 getopt.c
--- getopt.c	2001/09/19 16:24:10	1.6
+++ getopt.c	2001/09/21 13:54:51
@@ -68,10 +68,17 @@ char    *optarg;		/* argument associated
-#ifndef __CYGWIN__
-#define __progname __argv[0]
+#if defined (__CYGWIN__)
 extern char __declspec(dllimport) *__progname;
+#elif defined (__MINGW32__)
+/*FIXME: This still causes Dr. Watson but this change allows getopt.c to build
+  for MinGW so Cygwin can continue to build normally.  Note, the Dr. Watson
+  is normal for Cygwin 1.3.3.
+extern char **_argv;
+#define __progname _argv[0]
+#define __progname __argv[0]
 #define IGNORE_FIRST	(*options == '-' || *options == '+')

More information about the Cygwin-patches mailing list