parseCommandLine function is unnecessary because __argc and __argv are defined in stdlib.h

This commit is contained in:
spacy51 2009-08-18 19:01:30 +00:00
parent 3ffff59c80
commit 3162c1554e
1 changed files with 2 additions and 57 deletions

View File

@ -407,57 +407,6 @@ VBA theApp;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// VBA initialization // 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() BOOL VBA::InitInstance()
{ {
#if _MSC_VER < 1400 #if _MSC_VER < 1400
@ -533,11 +482,8 @@ BOOL VBA::InitInstance()
if (m_lpCmdLine[0]) if (m_lpCmdLine[0])
{ {
int argc = parseCommandLine(m_lpCmdLine, NULL); if(__argc > 0) {
char **argv = (char **)malloc((argc+1)*sizeof(char *)); szFile = __argv[1];
parseCommandLine(m_lpCmdLine, argv);
if(argc > 0) {
szFile = argv[0];
filename = szFile; filename = szFile;
} }
int index = filename.ReverseFind('.'); int index = filename.ReverseFind('.');
@ -549,7 +495,6 @@ BOOL VBA::InitInstance()
emulating = true; emulating = true;
else else
emulating = false; emulating = false;
free(argv);
} }
return TRUE; return TRUE;