diff options
author | marha <marha@users.sourceforge.net> | 2009-11-06 14:25:11 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-11-06 14:25:11 +0000 |
commit | 644f187f8844c573ec9920de33b47892266c6457 (patch) | |
tree | 07492813b12c5dc10d6139b7da73183b34806a5d /libwinmain/winmain.c | |
parent | 685a5b0d13ec50e7340f293c519b540a7eefb885 (diff) | |
download | vcxsrv-644f187f8844c573ec9920de33b47892266c6457.tar.gz vcxsrv-644f187f8844c573ec9920de33b47892266c6457.tar.bz2 vcxsrv-644f187f8844c573ec9920de33b47892266c6457.zip |
Solved problem when argument was surrounded by quotes.
Diffstat (limited to 'libwinmain/winmain.c')
-rw-r--r-- | libwinmain/winmain.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/libwinmain/winmain.c b/libwinmain/winmain.c index c4a8bf815..899a56ba9 100644 --- a/libwinmain/winmain.c +++ b/libwinmain/winmain.c @@ -5,17 +5,29 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL int argc=1; char ProgramName[255]; #define MAXNRARGS 100 - char *argv[MAXNRARGS]={"plink"}; - char *pTmp=lpCmdLine; + char *argv[MAXNRARGS]; + char *pTmp; + char *pProgramName; GetModuleFileName(NULL,ProgramName,255); - argv[0]=ProgramName; + pTmp=strrchr(ProgramName,'\\'); + if (pTmp) + pProgramName=pTmp+1; + else + pProgramName=ProgramName; + pTmp=strrchr(pProgramName,'.'); + if (pTmp) + *pTmp=0; + argv[0]=pProgramName; + + pTmp=lpCmdLine; while (*pTmp && argc<MAXNRARGS-1) { char *pEnd; if (*pTmp=='"') { - pEnd=strchr(pTmp+1,'"'); + pTmp++; + pEnd=strchr(pTmp,'"'); } else if (*pTmp!=' ') { |