/* MSVC Console EXE needs main() */ int main(int argc, char *argv[]) { /* need to get instance handle */ ghInstance = GetModuleHandle(NULL); return new_main(argc, argv); }
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int cmdShow) { #if defined(_MSC_VER) /* MSC doesn't give us _argc and _argv[] so ... */ #define MAXCMDTOKENS 128 int _argc=0; LPSTR _argv[MAXCMDTOKENS]; LPSTR p, q; #ifdef __WIN32__ _argv[_argc] = "gswin32.exe"; #else _argv[_argc] = "gswin.exe"; #endif // Parse command line handling quotes. p = lpszCmdLine; while (*p) { // for each argument while ((*p) && (*p == ' ')) p++; // skip over leading spaces if (*p == '\042') { p++; // skip " q = p; // scan to end of argument // doesn't handle embedded quotes while ((*p) && (*p != '\042')) p++; _argv[++_argc] = q; if (*p) *p++ = '\0'; } else if (*p) { // delimited by spaces q = p; while ((*p) && (*p != ' ')) p++; _argv[++_argc] = q; if (*p) *p++ = '\0'; } } _argv[++_argc] = (LPSTR)NULL; #endif if (hPrevInstance) { fputs("Can't run twice", stdout); return FALSE; } /* copy the hInstance into a variable so it can be used */ ghInstance = hInstance; return new_main(_argc, _argv); }
int main(int argc, char *argv[]) { new_main(argc, argv); }