git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10655
d7cf8633-e32d-0410-b094-
e92efae38249
char line[MAX_INPUTLINE];
char preprocessed[MAX_INPUTLINE];
char *firstchar;
char line[MAX_INPUTLINE];
char preprocessed[MAX_INPUTLINE];
char *firstchar;
- qboolean quotes, comment;
+ qboolean quotes;
+ char *comment;
// LordHavoc: making sure the tokenizebuffer doesn't get filled up by repeated crashes
cmd_tokenizebufferpos = 0;
// LordHavoc: making sure the tokenizebuffer doesn't get filled up by repeated crashes
cmd_tokenizebufferpos = 0;
text = (char *)cmd_text.data;
quotes = false;
text = (char *)cmd_text.data;
quotes = false;
for (i=0 ; i < cmd_text.cursize ; i++)
{
if(!comment)
for (i=0 ; i < cmd_text.cursize ; i++)
{
if(!comment)
else
{
if(text[i] == '/' && text[i + 1] == '/' && (i == 0 || ISWHITESPACE(text[i-1])))
else
{
if(text[i] == '/' && text[i + 1] == '/' && (i == 0 || ISWHITESPACE(text[i-1])))
if(text[i] == ';')
break; // don't break if inside a quoted string or comment
}
if(text[i] == ';')
break; // don't break if inside a quoted string or comment
}
- memcpy (line, text, i);
- line[i] = 0;
+ memcpy (line, text, comment ? (comment - text) : i);
+ line[comment ? (comment - text) : 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
}
// execute the command line
}
// execute the command line
- firstchar = line + strspn(line, " \t");
+ firstchar = line;
+ while(*firstchar && ISWHITESPACE(*firstchar))
+ ++firstchar;
- (strncmp(firstchar, "alias", 5) || (firstchar[5] != ' ' && firstchar[5] != '\t'))
+ (strncmp(firstchar, "alias", 5) || !ISWHITESPACE(firstchar[5]))
- (strncmp(firstchar, "bind", 4) || (firstchar[4] != ' ' && firstchar[4] != '\t'))
+ (strncmp(firstchar, "bind", 4) || !ISWHITESPACE(firstchar[4]))
- (strncmp(firstchar, "in_bind", 7) || (firstchar[7] != ' ' && firstchar[7] != '\t'))
+ (strncmp(firstchar, "in_bind", 7) || !ISWHITESPACE(firstchar[7]))
)
{
Cmd_PreprocessString( line, preprocessed, sizeof(preprocessed), NULL );
)
{
Cmd_PreprocessString( line, preprocessed, sizeof(preprocessed), NULL );