/* Launch4j (http://launch4j.sourceforge.net/) Cross-platform Java application wrapper for creating Windows native executables. Copyright (C) 2004, 2006 Grzegorz Kowal This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html) */ #include "../resource.h" #include "../head.h" int main(int argc, char* argv[]) { //added by oran - to store the value of the 'subcommand' to be run char subcom[8] = "run"; setConsoleFlag(); HMODULE hLibrary = NULL; char cmdLine[BIG_STR] = {0}; int i; // causes error: 'for' loop initial declaration used outside C99 mode. for (i = 1; i < argc; i++) { BOOL quote = strchr(argv[i], ' ') != NULL; if (quote) { strcat(cmdLine, "\""); } strcat(cmdLine, argv[i]); if (quote) { strcat(cmdLine, "\""); } if ( _stricmp(argv[i], "-find") == 0 ) { strcpy( subcom, "find" ); } else if ( _stricmp(argv[i], "-compare") == 0 ) { strcpy( subcom, "compare" ); } if (i < argc - 1) { strcat(cmdLine, " "); } } if (!prepare(hLibrary, cmdLine, subcom)) { if (hLibrary != NULL) { FreeLibrary(hLibrary); } return 1; } FreeLibrary(hLibrary); int result = (int) execute(TRUE); if (result == -1) { char errMsg[BIG_STR]; strcpy(errMsg, "could not start the application: "); strcat(errMsg, strerror(errno)); msgBox(errMsg); return 1; } else { return result; } }