summaryrefslogtreecommitdiff
path: root/cmdutils.c
diff options
context:
space:
mode:
authorDiogo Franco <diogomfranco@gmail.com>2013-08-07 08:25:51 -0300
committerMartin Storsjö <martin@martin.st>2013-08-08 10:59:03 +0300
commite8edf4e1cf6051802ad717dcf8a454d4661929af (patch)
treebe8dee613bd35d4d4e3424676607fb8e56333e59 /cmdutils.c
parent51eb213d00154b8e7856c7667ea62db8b0f663d4 (diff)
cmdutils: Only do the windows-specific commandline parsing on _WIN32
Fixes commandline parsing on Cygwin (on 64 bit, and on very recent 32 bit), where the configure check does find the CommandLineToArgvW function (since it exists in the link libraries and in the headers), but whose GetCommandLineW() only returns the application's path. (This is due to a cygwin internal optimization, see http://cygwin.com/ml/cygwin/2013-07/msg00538.html for details.) Arguments are only given through main's argc/argv, and they're already UTF-8. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 8e43795191..062d7ec2f8 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -182,7 +182,10 @@ static const OptionDef *find_option(const OptionDef *po, const char *name)
return po;
}
-#if HAVE_COMMANDLINETOARGVW
+/* _WIN32 means using the windows libc - cygwin doesn't define that
+ * by default. HAVE_COMMANDLINETOARGVW is true on cygwin, while
+ * it doesn't provide the actual command line via GetCommandLineW(). */
+#if HAVE_COMMANDLINETOARGVW && defined(_WIN32)
#include <windows.h>
#include <shellapi.h>
/* Will be leaked on exit */