Mercurial > dwindows
diff winmain.c @ 1802:aedf5903db0a
Add DW_FCF_TEXTURED window style; relevant only for Mac port.
Remove NSTexturedBackgroundWindowMask from style in dw_window_new.
Add Copyright notice to winmain.c.
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 27 Sep 2012 05:09:10 +0000 |
parents | 32b5fba0b00a |
children | 05dd5189099f |
line wrap: on
line diff
--- a/winmain.c Thu Sep 27 04:26:34 2012 +0000 +++ b/winmain.c Thu Sep 27 05:09:10 2012 +0000 @@ -1,5 +1,7 @@ /* Dynamic Windows stub file to allow Win32 applications * to use the main() entry point instead of WinMain(). + * + * (C) 2000-2012 Brian Smith <brian@dbsoft.org> */ #include <windows.h> @@ -14,99 +16,99 @@ char **_convertargs(int *count, char *start, HINSTANCE DWInstance) { - char *tmp, *argstart, **argv; - int loc = 0, inquotes = 0; + char *tmp, *argstart, **argv; + int loc = 0, inquotes = 0; - (*count) = 1; + (*count) = 1; - tmp = start; + tmp = start; - /* Count the number of entries */ - if(*start) - { - (*count)++; + /* Count the number of entries */ + if(*start) + { + (*count)++; - while(*tmp) - { - if(*tmp == '"' && inquotes) - inquotes = 0; - else if(*tmp == '"' && !inquotes) - inquotes = 1; - else if(*tmp == ' ' && !inquotes) - { - /* Push past any white space */ - while(*(tmp+1) == ' ') - tmp++; - /* If we aren't at the end of the command - * line increment the count. - */ - if(*(tmp+1)) - (*count)++; - } - tmp++; - } - } + while(*tmp) + { + if(*tmp == '"' && inquotes) + inquotes = 0; + else if(*tmp == '"' && !inquotes) + inquotes = 1; + else if(*tmp == ' ' && !inquotes) + { + /* Push past any white space */ + while(*(tmp+1) == ' ') + tmp++; + /* If we aren't at the end of the command + * line increment the count. + */ + if(*(tmp+1)) + (*count)++; + } + tmp++; + } + } - argv = (char **)malloc(sizeof(char *) * ((*count)+1)); - argv[0] = malloc(260); - GetModuleFileNameA(DWInstance, argv[0], 260); + argv = (char **)malloc(sizeof(char *) * ((*count)+1)); + argv[0] = malloc(260); + GetModuleFileNameA(DWInstance, argv[0], 260); - argstart = tmp = start; + argstart = tmp = start; - if(*start) - { - loc = 1; + if(*start) + { + loc = 1; - while(*tmp) - { - if(*tmp == '"' && inquotes) - { - *tmp = 0; - inquotes = 0; - } - else if(*tmp == '"' && !inquotes) - { - argstart = tmp+1; - inquotes = 1; - } - else if(*tmp == ' ' && !inquotes) - { - *tmp = 0; - argv[loc] = strdup(argstart); + while(*tmp) + { + if(*tmp == '"' && inquotes) + { + *tmp = 0; + inquotes = 0; + } + else if(*tmp == '"' && !inquotes) + { + argstart = tmp+1; + inquotes = 1; + } + else if(*tmp == ' ' && !inquotes) + { + *tmp = 0; + argv[loc] = strdup(argstart); - /* Push past any white space */ - while(*(tmp+1) == ' ') - tmp++; + /* Push past any white space */ + while(*(tmp+1) == ' ') + tmp++; - /* Move the start pointer */ - argstart = tmp+1; + /* Move the start pointer */ + argstart = tmp+1; - /* If we aren't at the end of the command - * line increment the count. - */ - if(*(tmp+1)) - loc++; - } - tmp++; - } - if(*argstart) - argv[loc] = strdup(argstart); - } - argv[loc+1] = NULL; - return argv; + /* If we aren't at the end of the command + * line increment the count. + */ + if(*(tmp+1)) + loc++; + } + tmp++; + } + if(*argstart) + argv[loc] = strdup(argstart); + } + argv[loc+1] = NULL; + return argv; } /* Ok this is a really big hack but what the hell ;) */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { - char **argv; - int argc; + char **argv; + int argc; #ifndef NODW - Win32_Set_Instance(hInstance); + Win32_Set_Instance(hInstance); #endif - argv = _convertargs(&argc, lpCmdLine, hInstance); + argv = _convertargs(&argc, lpCmdLine, hInstance); - return main(argc, argv); + return main(argc, argv); }