return;
}
- SZ_Write (&cmd_text, text, (int)strlen (text));
+ SZ_Write (&cmd_text, (const qbyte *)text, (int)strlen (text));
}
templen = cmd_text.cursize;
if (templen)
{
- temp = Mem_Alloc (tempmempool, templen);
+ temp = (char *)Mem_Alloc (tempmempool, templen);
memcpy (temp, cmd_text.data, templen);
SZ_Clear (&cmd_text);
}
// add the copied off data
if (temp != NULL)
{
- SZ_Write (&cmd_text, temp, templen);
+ SZ_Write (&cmd_text, (const qbyte *)temp, templen);
Mem_Free (temp);
}
}
{
cmdalias_t *prev, *current;
- a = Z_Malloc (sizeof(cmdalias_t));
+ a = (cmdalias_t *)Z_Malloc (sizeof(cmdalias_t));
strlcpy (a->name, s, sizeof (a->name));
// insert it at the right alphanumeric position
for( prev = NULL, current = cmd_alias ; current && strcmp( current->name, a->name ) < 0 ; prev = current, current = current->next )
}
strlcat (cmd, "\n", sizeof (cmd));
- a->value = Z_Malloc (strlen (cmd) + 1);
+ a->value = (char *)Z_Malloc (strlen (cmd) + 1);
strcpy (a->value, cmd);
}
outlen = 0;
inquote = 0;
- while( *in && outlen < ALIAS_BUFFER )
+ while( *in && outlen < ALIAS_BUFFER )
{
- if( *in == '"' )
+ if( *in == '"' )
{
inquote ^= 1;
- }
- else if( *in == '$' && !inquote )
+ }
+ else if( *in == '$' && !inquote )
{
// $* is replaced with all formal parameters, $num is parsed as an argument (or as $num if there arent enough parameters), $bla becomes $bla and $$bla becomes $$bla
// read over the $
in++;
- if( *in == '*' )
+ if( *in == '*' )
{
const char *linein = Cmd_Args();
// include all params
- while( *linein && outlen < ALIAS_BUFFER ) {
- *out++ = *linein++;
- outlen++;
+ if (linein) {
+ while( *linein && outlen < ALIAS_BUFFER ) {
+ *out++ = *linein++;
+ outlen++;
+ }
}
in++;
if (!COM_ParseTokenConsole(&text))
return;
- // check for $cvar
+ // check for $cvar
// (perhaps use another target buffer?)
- if (com_token[0] == '$' && com_token[1])
+ if (com_token[0] == '$' && com_token[1])
{
cvar_t *cvar;
{
// remove the first $
char *pos;
-
+
for( pos = com_token ; *pos ; pos++ )
{
*pos = *(pos + 1);
}
}
- cmd = Mem_Alloc(cmd_mempool, sizeof(cmd_function_t));
+ cmd = (cmd_function_t *)Mem_Alloc(cmd_mempool, sizeof(cmd_function_t));
cmd->name = cmd_name;
cmd->function = function;
cmd->next = cmd_functions;
const char **buf;
len = strlen(partial);
- buf = Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
+ buf = (const char **)Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
// Loop through the alias list and print all matches
for (cmd = cmd_functions; cmd; cmd = cmd->next)
if (!strncasecmp(partial, cmd->name, len))
const char **buf;
len = strlen(partial);
- buf = Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
+ buf = (const char **)Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
// Loop through the alias list and print all matches
for (alias = cmd_alias; alias; alias = alias->next)
if (!strncasecmp(partial, alias->name, len))
// attention, it has been eradicated from here, its only (former) use in
// all of darkplaces.
MSG_WriteByte(&cls.message, clc_stringcmd);
- SZ_Write(&cls.message, s, (int)strlen(s) + 1);
+ SZ_Write(&cls.message, (const qbyte *)s, (int)strlen(s) + 1);
}
/*
void Cmd_ForwardToServer (void)
{
const char *s;
- if (strcasecmp(Cmd_Argv(0), "cmd"))
- s = va("%s %s", Cmd_Argv(0), Cmd_Argc() > 1 ? Cmd_Args() : "");
- else
+ if (!strcasecmp(Cmd_Argv(0), "cmd"))
+ {
+ // we want to strip off "cmd", so just send the args
s = Cmd_Argc() > 1 ? Cmd_Args() : "";
+ }
+ else
+ {
+ // we need to keep the command name, so send Cmd_Argv(0), a space and then Cmd_Args()
+ s = va("%s %s", Cmd_Argv(0), Cmd_Argc() > 1 ? Cmd_Args() : "");
+ }
+ // don't send an empty forward message if the user tries "cmd" by itself
+ if (!s || !*s)
+ return;
Cmd_ForwardStringToServer(s);
}