a539f7edfc8c3e04e0768d5255bc4a98b438a1f3
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.
25 * $Date: 1999/04/02 21:43:56 $
29 #include <crtdll/stdlib.h>
30 #include <crtdll/process.h>
33 #define ISSPACE(a) (a == ' ' || a == '\t')
35 extern int PASCAL
WinMain (HANDLE hInst
, HANDLE hPrevInst
, LPSTR szCmdLine
,
39 main (int argc
, char* argv
[], char* environ
[])
42 STARTUPINFO startinfo
;
45 /* Get the command line passed to the process. */
46 szCmd
= GetCommandLineA();
47 GetStartupInfoA(&startinfo
);
49 /* Strip off the name of the application and any leading
53 while(ISSPACE(*szCmd
))
58 /* On my system I always get the app name enclosed
66 while (*szCmd
!= '\"' && *szCmd
!= '\0');
75 /* If no quotes then assume first token is program
77 while (!ISSPACE(*szCmd
) && *szCmd
!= '\0')
83 while (ISSPACE(*szCmd
))
89 nRet
= WinMain (GetModuleHandle(NULL
), NULL
, szCmd
,
90 (startinfo
.dwFlags
& STARTF_USESHOWWINDOW
) ?
91 startinfo
.wShowWindow
: SW_SHOWDEFAULT
);