mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Merge branch 'quote-shenanigans' into 'master'
Stuff I Broke: Commands See merge request STJr/SRB2!607
This commit is contained in:
commit
35fe2e7281
1 changed files with 33 additions and 15 deletions
|
@ -427,20 +427,21 @@ static void COM_TokenizeString(char *ptext)
|
|||
|
||||
com_argc = 0;
|
||||
com_args = NULL;
|
||||
|
||||
if (ptext[0] == '\033')
|
||||
{
|
||||
com_flags = (unsigned)ptext[1];
|
||||
ptext += 2;
|
||||
}
|
||||
else
|
||||
com_flags = 0;
|
||||
com_flags = 0;
|
||||
|
||||
while (com_argc < MAX_ARGS)
|
||||
{
|
||||
// Skip whitespace up to a newline.
|
||||
while (*ptext != '\0' && *ptext <= ' ' && *ptext != '\n')
|
||||
ptext++;
|
||||
{
|
||||
if (ptext[0] == '\033')
|
||||
{
|
||||
com_flags = (unsigned)ptext[1];
|
||||
ptext += 2;
|
||||
}
|
||||
else
|
||||
ptext++;
|
||||
}
|
||||
|
||||
// A newline means end of command in buffer,
|
||||
// thus end of this command's args too.
|
||||
|
@ -2169,8 +2170,13 @@ skipwhite:
|
|||
com_token[len] = 0;
|
||||
return data;
|
||||
}
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
if (c == '\033')
|
||||
data += 2;
|
||||
else
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2186,10 +2192,22 @@ skipwhite:
|
|||
// parse a regular word
|
||||
do
|
||||
{
|
||||
com_token[len] = c;
|
||||
data++;
|
||||
len++;
|
||||
c = *data;
|
||||
if (c == '\033')
|
||||
{
|
||||
do
|
||||
{
|
||||
data += 2;
|
||||
c = *data;
|
||||
}
|
||||
while (c == '\033') ;
|
||||
}
|
||||
else
|
||||
{
|
||||
com_token[len] = c;
|
||||
data++;
|
||||
len++;
|
||||
c = *data;
|
||||
}
|
||||
if (c == '{' || c == '}' || c == ')'|| c == '(' || c == '\'')
|
||||
break;
|
||||
} while (c > 32);
|
||||
|
|
Loading…
Reference in a new issue