From 5c095672f598f0ee564c9926a53d0f03ab6aa382 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 29 Mar 2010 15:27:13 +0000 Subject: [PATCH] APPEND forced args, not PREPEND, as earlier arguments win in most DP options. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10063 d7cf8633-e32d-0410-b094-e92efae38249 --- fs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs.c b/fs.c index 538cf437..6058893e 100644 --- a/fs.c +++ b/fs.c @@ -1622,13 +1622,16 @@ void FS_Init_SelfPack (void) const char **new_argv; int i = 0; int args_left = 256; + new_argv = (const char **)Mem_Alloc(fs_mempool, sizeof(*com_argv) * (com_argc + args_left + 2)); if(com_argc == 0) { - com_argv[0] = "dummy"; - com_argv[1] = NULL; + new_argv[0] = "dummy"; com_argc = 1; } - new_argv = (const char **)Mem_Alloc(fs_mempool, sizeof(*com_argv) * (com_argc + args_left + 1)); + else + { + memcpy(&new_argv[0], &com_argv[0], sizeof(*com_argv) * com_argc); + } p = buf; while(COM_ParseToken_Console(&p)) { @@ -1636,11 +1639,10 @@ void FS_Init_SelfPack (void) break; q = (char *)Mem_Alloc(fs_mempool, strlen(com_token) + 1); strlcpy(q, com_token, strlen(com_token) + 1); - new_argv[i+1] = q; + new_argv[com_argc + i] = q; ++i; } - new_argv[0] = com_argv[0]; - memcpy(&new_argv[i+2], &com_argv[1], sizeof(*com_argv) * com_argc); + new_argv[i+com_argc] = NULL; com_argv = new_argv; com_argc = com_argc + i; } -- 2.39.2