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
This commit is contained in:
spacy51 2009-08-18 19:01:30 +00:00
parent ab7a3f2652
commit 11ec4822ae
1 changed files with 2 additions and 57 deletions

View File

@ -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;