Error out when assigning void value.
[tinycc/miki.git] / win32 / lib / wincrt1.c
blob0466da913a991f44571c8465c4cd02d20dcf8a5a
1 //+---------------------------------------------------------------------------
3 #include <windows.h>
5 #define __UNKNOWN_APP 0
6 #define __CONSOLE_APP 1
7 #define __GUI_APP 2
8 void __set_app_type(int);
9 void _controlfp(unsigned a, unsigned b);
11 int _winstart(void)
13 __TRY__
14 char *szCmd;
15 STARTUPINFO startinfo;
16 int fShow;
17 int ret;
19 __set_app_type(__GUI_APP);
20 _controlfp(0x10000, 0x30000);
22 szCmd = GetCommandLine();
23 if (szCmd) {
24 while (' ' == *szCmd)
25 szCmd++;
26 if ('\"' == *szCmd) {
27 while (*++szCmd)
28 if ('\"' == *szCmd) {
29 szCmd++;
30 break;
32 } else {
33 while (*szCmd && ' ' != *szCmd)
34 szCmd++;
36 while (' ' == *szCmd)
37 szCmd++;
40 GetStartupInfo(&startinfo);
41 fShow = startinfo.wShowWindow;
42 if (0 == (startinfo.dwFlags & STARTF_USESHOWWINDOW))
43 fShow = SW_SHOWDEFAULT;
45 ret = WinMain(GetModuleHandle(NULL), NULL, szCmd, fShow);
46 exit(ret);
49 int _runwinmain(int argc, char **argv)
51 char *szCmd, *p;
53 p = GetCommandLine();
54 szCmd = NULL;
55 if (argc > 1)
56 szCmd = strstr(p, argv[1]);
57 if (NULL == szCmd)
58 szCmd = "";
59 else if (szCmd > p && szCmd[-1] == '\"')
60 --szCmd;
61 return WinMain(GetModuleHandle(NULL), NULL, szCmd, SW_SHOWDEFAULT);