3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
7 * Extra startup code for applications which do not have a main function
8 * of their own (but do have a WinMain). Generally these are GUI
9 * applications, but they don't *have* to be.
17 #define ISSPACE(a) (a == ' ' || a == '\t')
19 extern int PASCAL
WinMain (HINSTANCE hInst
, HINSTANCE hPrevInst
,
20 LPSTR szCmdLine
, int nShow
);
23 main (int argc
, const char *argv
[], const char *environ
[])
26 STARTUPINFO startinfo
;
29 /* Get the command line passed to the process. */
30 szCmd
= GetCommandLineA ();
31 GetStartupInfoA (&startinfo
);
33 /* Strip off the name of the application and any leading
37 while (ISSPACE (*szCmd
))
42 /* On my system I always get the app name enclosed
50 while (*szCmd
!= '\"' && *szCmd
!= '\0');
59 /* If no quotes then assume first token is program
61 while (!ISSPACE (*szCmd
) && *szCmd
!= '\0')
67 while (ISSPACE (*szCmd
))
73 nRet
= WinMain (GetModuleHandle (NULL
), NULL
, szCmd
,
74 (startinfo
.dwFlags
& STARTF_USESHOWWINDOW
) ?
75 startinfo
.wShowWindow
: SW_SHOWDEFAULT
);