From afccf89beb79311062e91701cd4215f7a04654ae Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Fri, 16 Oct 2020 22:45:58 +0000 Subject: [PATCH] cmd: Add a "cmdline" field to cmd_state_t and fill it. 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 | 3 +++ cmd.h | 1 + 2 files changed, 4 insertions(+) diff --git a/cmd.c b/cmd.c index 4a899122..ba5e5467 100644 --- 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 f7b3b4d1..b1056007 100644 --- 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; -- 2.39.2