summaryrefslogtreecommitdiff
path: root/setup/execute.c
diff options
context:
space:
mode:
authorSimon Howard2010-12-25 21:51:24 +0000
committerSimon Howard2010-12-25 21:51:24 +0000
commita8839cecaa12fc3d9afb2bad0863b7b97901bc4c (patch)
tree39ad8934fb0bcd28060f849fda2d6b5917b014c3 /setup/execute.c
parenta854f3e246be1373200a296413b31ece296c2914 (diff)
downloadchocolate-doom-a8839cecaa12fc3d9afb2bad0863b7b97901bc4c.tar.gz
chocolate-doom-a8839cecaa12fc3d9afb2bad0863b7b97901bc4c.tar.bz2
chocolate-doom-a8839cecaa12fc3d9afb2bad0863b7b97901bc4c.zip
Pass through all command line arguments specified to the setup tool to
the game, to match Vanilla behavior (thanks AlexXav). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2227
Diffstat (limited to 'setup/execute.c')
-rw-r--r--setup/execute.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/setup/execute.c b/setup/execute.c
index 8e753f60..69442b5d 100644
--- a/setup/execute.c
+++ b/setup/execute.c
@@ -101,6 +101,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;
@@ -119,25 +155,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;