4 * Extra startup code for applications which do not have a main function
5 * of their own (but do have a WinMain). Generally these are GUI
6 * applications, but they don't *have* to be.
8 * This file is part of the Mingw32 package.
11 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
13 * THIS SOFTWARE IS NOT COPYRIGHTED
15 * This source code is offered for use in the public domain. You may
16 * use, modify or distribute it freely.
18 * This code is distributed in the hope that it will be useful but
19 * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
20 * DISCLAMED. This includes but is not limited to warrenties of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
30 #include <msvcrt/stdlib.h>
31 #include <msvcrt/process.h>
34 #define ISSPACE(a) (a == ' ' || a == '\t')
36 extern int PASCAL
WinMain (HANDLE hInst
, HANDLE hPrevInst
, LPSTR szCmdLine
, int nShow
);
38 int main(int argc
, char* argv
[], char* environ
[])
41 STARTUPINFO startinfo
;
44 /* Get the command line passed to the process. */
45 szCmd
= GetCommandLineA();
46 GetStartupInfoA(&startinfo
);
48 /* Strip off the name of the application and any leading
52 while(ISSPACE(*szCmd
))
57 /* On my system I always get the app name enclosed
65 while (*szCmd
!= '\"' && *szCmd
!= '\0');
74 /* If no quotes then assume first token is program
76 while (!ISSPACE(*szCmd
) && *szCmd
!= '\0')
82 while (ISSPACE(*szCmd
))
88 nRet
= WinMain (GetModuleHandle(NULL
), NULL
, szCmd
,
89 (startinfo
.dwFlags
& STARTF_USESHOWWINDOW
) ?
90 startinfo
.wShowWindow
: SW_SHOWDEFAULT
);