From 11ec4822ae00c4def62a89f731fc8d81c3de9f23 Mon Sep 17 00:00:00 2001 From: spacy51 Date: Tue, 18 Aug 2009 19:01:30 +0000 Subject: [PATCH] parseCommandLine function is unnecessary because __argc and __argv are defined in stdlib.h git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@892 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/win32/VBA.cpp | 59 ++--------------------------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 02527433..c08189f7 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -407,57 +407,6 @@ VBA theApp; ///////////////////////////////////////////////////////////////////////////// // VBA initialization -// code from SDL_main.c for Windows -/* Parse a command line buffer into arguments */ -static int parseCommandLine(char *cmdline, char **argv) -{ - char *bufp; - int argc; - - argc = 0; - for ( bufp = cmdline; *bufp; ) { - /* Skip leading whitespace */ - while ( isspace(*bufp) ) { - ++bufp; - } - /* Skip over argument */ - if ( *bufp == '"' ) { - ++bufp; - if ( *bufp ) { - if ( argv ) { - argv[argc] = bufp; - } - ++argc; - } - /* Skip over word */ - while ( *bufp && (*bufp != '"') ) { - ++bufp; - } - } else { - if ( *bufp ) { - if ( argv ) { - argv[argc] = bufp; - } - ++argc; - } - /* Skip over word */ - while ( *bufp && ! isspace(*bufp) ) { - ++bufp; - } - } - if ( *bufp ) { - if ( argv ) { - *bufp = '\0'; - } - ++bufp; - } - } - if ( argv ) { - argv[argc] = NULL; - } - return(argc); -} - BOOL VBA::InitInstance() { #if _MSC_VER < 1400 @@ -533,11 +482,8 @@ BOOL VBA::InitInstance() if (m_lpCmdLine[0]) { - int argc = parseCommandLine(m_lpCmdLine, NULL); - char **argv = (char **)malloc((argc+1)*sizeof(char *)); - parseCommandLine(m_lpCmdLine, argv); - if(argc > 0) { - szFile = argv[0]; + if(__argc > 0) { + szFile = __argv[1]; filename = szFile; } int index = filename.ReverseFind('.'); @@ -549,7 +495,6 @@ BOOL VBA::InitInstance() emulating = true; else emulating = false; - free(argv); } return TRUE;