Browse Source

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>
tags/n2.1
Diogo Franco Martin Storsjö 12 years ago
parent
commit
e8edf4e1cf
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      cmdutils.c

+ 4
- 1
cmdutils.c View File

@@ -182,7 +182,10 @@ static const OptionDef *find_option(const OptionDef *po, const char *name)
return po; 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 <windows.h>
#include <shellapi.h> #include <shellapi.h>
/* Will be leaked on exit */ /* Will be leaked on exit */


Loading…
Cancel
Save