]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
cmd: Add a "cmdline" field to cmd_state_t and fill it.
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Oct 2020 22:45:58 +0000 (22:45 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Oct 2020 22:45:58 +0000 (22:45 +0000)
This will be useful for commands that need to read the
entire command-line, as entered in the buffer, for some reason.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13009 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c
cmd.h

diff --git a/cmd.c b/cmd.c
index 4a8991225c6ad9376e25881652455c86ddd9000b..ba5e5467b7864f44d8a32542373c51b3028f716f 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -1761,6 +1761,7 @@ static void Cmd_TokenizeString (cmd_state_t *cmd, const char *text)
 
        cmd->argc = 0;
        cmd->args = NULL;
+       cmd->cmdline = NULL;
 
        while (1)
        {
@@ -1784,6 +1785,8 @@ static void Cmd_TokenizeString (cmd_state_t *cmd, const char *text)
                if (!*text)
                        return;
 
+               if(!cmd->argc)
+                       cmd->cmdline = text;
                if (cmd->argc == 1)
                        cmd->args = text;
 
diff --git a/cmd.h b/cmd.h
index f7b3b4d1078b31ae4d7bb902dfca225b1fcb9b5f..b10560077b9baa6abbc712a8158fdb07f65264f6 100644 (file)
--- a/cmd.h
+++ b/cmd.h
@@ -125,6 +125,7 @@ typedef struct cmd_state_s
        struct mempool_s *mempool;
 
        int argc;
+       const char *cmdline;
        const char *argv[MAX_ARGS];
        const char *null_string;
        const char *args;