4 * This file has no copyright assigned and is placed in the Public Domain.
5 * This file is a part of the mingw-runtime package.
6 * No warranty is given; refer to the file DISCLAIMER within the package.
8 * Extra startup code for applications which do not have a main function
9 * of their own (but do have a WinMain). Generally these are GUI
10 * applications, but they don't *have* to be.
17 #define ISSPACE(a) (a == ' ' || a == '\t')
19 extern int PASCAL WinMain (HINSTANCE, HINSTANCE, LPSTR, int);
22 main (int argc, char *argv[], char **envp)
25 STARTUPINFO startinfo;
27 /* Get the command line passed to the process. */
28 szCmd = GetCommandLineA ();
29 GetStartupInfoA (&startinfo);
31 /* Strip off the name of the application and any leading
35 while (ISSPACE (*szCmd))
40 /* On my system I always get the app name enclosed
48 while (*szCmd != '\"' && *szCmd != '\0');
57 /* If no quotes then assume first token is program
59 while (!ISSPACE (*szCmd) && *szCmd != '\0')
65 while (ISSPACE (*szCmd))
71 return WinMain( GetModuleHandle (NULL), NULL, szCmd,
72 (startinfo.dwFlags & STARTF_USESHOWWINDOW)
73 ? startinfo.wShowWindow