]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
APPEND forced args, not PREPEND, as earlier arguments win in most DP options.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 29 Mar 2010 15:27:13 +0000 (15:27 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 29 Mar 2010 15:27:13 +0000 (15:27 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10063 d7cf8633-e32d-0410-b094-e92efae38249

fs.c

diff --git a/fs.c b/fs.c
index 538cf4376f7a4ac2c20a762b88d3cd0ad5a18ab2..6058893ec1d50023d841f33b70887a54c6dec235 100644 (file)
--- 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;
                        }