mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2025-02-19 10:10:48 +00:00
Merc's method of doing \ escapes was psychotic and didn't work anyway, so
I'm removing it.
This commit is contained in:
parent
cf0201eeea
commit
1393594ee6
1 changed files with 7 additions and 21 deletions
26
common/cmd.c
26
common/cmd.c
|
@ -152,11 +152,10 @@ Cbuf_Execute
|
||||||
*/
|
*/
|
||||||
void Cbuf_Execute (void)
|
void Cbuf_Execute (void)
|
||||||
{
|
{
|
||||||
int i, li;
|
int i;//, li;
|
||||||
char *text;
|
char *text;
|
||||||
char line[1024] = {0};
|
char line[1024] = {0};
|
||||||
int quotes;
|
int quotes;
|
||||||
qboolean escape;
|
|
||||||
|
|
||||||
while (cmd_text.cursize)
|
while (cmd_text.cursize)
|
||||||
{
|
{
|
||||||
|
@ -164,31 +163,18 @@ void Cbuf_Execute (void)
|
||||||
text = (char *)cmd_text.data;
|
text = (char *)cmd_text.data;
|
||||||
|
|
||||||
quotes = 0;
|
quotes = 0;
|
||||||
escape = false;
|
|
||||||
li = 0;
|
|
||||||
for (i=0 ; i< cmd_text.cursize ; i++)
|
for (i=0 ; i< cmd_text.cursize ; i++)
|
||||||
{
|
{
|
||||||
if (escape) {
|
if (text[i] == '"')
|
||||||
escape = false;
|
|
||||||
line[li] = text[i];
|
|
||||||
li++;
|
|
||||||
} else if (text[i] == '\\') {
|
|
||||||
escape = true;
|
|
||||||
} else if (text[i] == '"') {
|
|
||||||
quotes++;
|
quotes++;
|
||||||
line[li] = text[li];
|
if ( !(quotes&1) && text[i] == ';')
|
||||||
li++;
|
|
||||||
} else if ( !(quotes&1) && text[i] == ';')
|
|
||||||
break; // don't break if inside a quoted string
|
break; // don't break if inside a quoted string
|
||||||
else if (text[i] == '\n' || text[i] == '\r')
|
if (text[i] == '\n' || text[i] == '\r')
|
||||||
break;
|
break;
|
||||||
else {
|
|
||||||
line[i] = text[i];
|
|
||||||
li++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
line[li] = '\0';
|
memcpy (line, text, i);
|
||||||
|
line[i] = '\0';
|
||||||
|
|
||||||
// delete the text from the command buffer and move remaining commands down
|
// delete the text from the command buffer and move remaining commands down
|
||||||
// this is necessary because commands (exec, alias) can insert data at the
|
// this is necessary because commands (exec, alias) can insert data at the
|
||||||
|
|
Loading…
Reference in a new issue