29 #include "../idlib/precompiled.h"
42 for ( i = 0; i <
argc; i++ ) {
58 }
else if ( end >=
argc ) {
63 strcat( cmd_args,
"\"" );
65 for ( i = start; i <=
end; i++ ) {
68 strcat( cmd_args,
"\" \"" );
70 strcat( cmd_args,
" " );
73 if ( escapeArgs && strchr(
argv[i],
'\\' ) ) {
75 while ( *p !=
'\0' ) {
77 strcat( cmd_args,
"\\\\" );
79 int l = strlen( cmd_args );
81 cmd_args[ l+1 ] =
'\0';
86 strcat( cmd_args,
argv[i] );
90 strcat( cmd_args,
"\"" );
118 lex.
LoadMemory( text, strlen( text ),
"idCmdSystemLocal::TokenizeString" );
138 if ( !keepAsStrings && ( token ==
"-" ) ) {
140 token =
"-" + number;
145 if ( token ==
"$" ) {
158 if ( totalLen + len + 1 >
sizeof(
tokenized ) ) {
196 return (
const char **)&
argv[0];
static const int MAX_COMMAND_ARGS
static const int MAX_COMMAND_STRING
const char ** GetArgs(int *argc)
const char * Args(int start=1, int end=-1, bool escapeArgs=false) const
int CheckTokenType(int type, int subtype, idToken *token)
void AppendArg(const char *text)
char * argv[MAX_COMMAND_ARGS]
virtual const char * GetCVarString(const char *name) const =0
static void Copynz(char *dest, const char *src, int destsize)
int LoadMemory(const char *ptr, int length, const char *name, int startLine=1)
void TokenizeString(const char *text, bool keepAsStrings)
void operator=(const idCmdArgs &args)
static class idCVarSystem * cvarSystem
const char * c_str(void) const
char tokenized[MAX_COMMAND_STRING]
int ReadToken(idToken *token)