diff options
author | Simon Howard | 2011-02-12 15:38:08 +0000 |
---|---|---|
committer | Simon Howard | 2011-02-12 15:38:08 +0000 |
commit | a9996b41e954d85fde5ec5188bbf6a7f4df88011 (patch) | |
tree | 113669ff889c9184aaa28224317c8b04c2c5bfeb /src/setup/execute.c | |
parent | 7d7b5087d2288fc6e2493448968f7d786043b389 (diff) | |
parent | a366f68b2959282b22ab6f08569a253f0540745c (diff) | |
download | chocolate-doom-a9996b41e954d85fde5ec5188bbf6a7f4df88011.tar.gz chocolate-doom-a9996b41e954d85fde5ec5188bbf6a7f4df88011.tar.bz2 chocolate-doom-a9996b41e954d85fde5ec5188bbf6a7f4df88011.zip |
Merge from trunk.
Subversion-branch: /branches/raven-branch
Subversion-revision: 2258
Diffstat (limited to 'src/setup/execute.c')
-rw-r--r-- | src/setup/execute.c | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/src/setup/execute.c b/src/setup/execute.c index 4be44149..f85b8af4 100644 --- a/src/setup/execute.c +++ b/src/setup/execute.c @@ -88,6 +88,42 @@ static char *TempFile(char *s) return result; } +static int ArgumentNeedsEscape(char *arg) +{ + char *p; + + for (p = arg; *p != '\0'; ++p) + { + if (isspace(*p)) + { + return 1; + } + } + + return 0; +} + +// Arguments passed to the setup tool should be passed through to the +// game when launching a game. Calling this adds all arguments from +// myargv to the output context. + +void PassThroughArguments(execute_context_t *context) +{ + int i; + + for (i = 1; i < myargc; ++i) + { + if (ArgumentNeedsEscape(myargv[i])) + { + AddCmdLineParameter(context, "\"%s\"", myargv[i]); + } + else + { + AddCmdLineParameter(context, "%s", myargv[i]); + } + } +} + execute_context_t *NewExecuteContext(void) { execute_context_t *result; @@ -106,25 +142,6 @@ execute_context_t *NewExecuteContext(void) return result; } -void AddConfigParameters(execute_context_t *context) -{ - int p; - - p = M_CheckParm("-config"); - - if (p > 0) - { - AddCmdLineParameter(context, "-config \"%s\"", myargv[p + 1]); - } - - p = M_CheckParm("-extraconfig"); - - if (p > 0) - { - AddCmdLineParameter(context, "-extraconfig \"%s\"", myargv[p + 1]); - } -} - void AddCmdLineParameter(execute_context_t *context, char *s, ...) { va_list args; |