Merge branch 'quote-shenanigans' into 'master'

Stuff I Broke: Commands

See merge request STJr/SRB2!607
This commit is contained in:
James R 2020-01-01 17:52:21 -05:00
commit 35fe2e7281

View file

@ -427,20 +427,21 @@ static void COM_TokenizeString(char *ptext)
com_argc = 0; com_argc = 0;
com_args = NULL; 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) while (com_argc < MAX_ARGS)
{ {
// Skip whitespace up to a newline. // Skip whitespace up to a newline.
while (*ptext != '\0' && *ptext <= ' ' && *ptext != '\n') while (*ptext != '\0' && *ptext <= ' ' && *ptext != '\n')
{
if (ptext[0] == '\033')
{
com_flags = (unsigned)ptext[1];
ptext += 2;
}
else
ptext++; ptext++;
}
// A newline means end of command in buffer, // A newline means end of command in buffer,
// thus end of this command's args too. // thus end of this command's args too.
@ -2169,10 +2170,15 @@ skipwhite:
com_token[len] = 0; com_token[len] = 0;
return data; return data;
} }
if (c == '\033')
data += 2;
else
{
com_token[len] = c; com_token[len] = c;
len++; len++;
} }
} }
}
// parse single characters // parse single characters
if (c == '{' || c == '}' || c == ')' || c == '(' || c == '\'') if (c == '{' || c == '}' || c == ')' || c == '(' || c == '\'')
@ -2185,11 +2191,23 @@ skipwhite:
// parse a regular word // parse a regular word
do do
{
if (c == '\033')
{
do
{
data += 2;
c = *data;
}
while (c == '\033') ;
}
else
{ {
com_token[len] = c; com_token[len] = c;
data++; data++;
len++; len++;
c = *data; c = *data;
}
if (c == '{' || c == '}' || c == ')'|| c == '(' || c == '\'') if (c == '{' || c == '}' || c == ')'|| c == '(' || c == '\'')
break; break;
} while (c > 32); } while (c > 32);