From 0425afb19047d63904f2c4f688605ed09118c19c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 22 Sep 2001 02:24:46 +0000 Subject: [PATCH] 'rcon localinfo motd "hi there"' now works --- qw/source/cl_main.c | 13 ++----------- qw/source/sv_main.c | 16 ++++------------ 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 51d265fef..92032fb8f 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -378,19 +378,10 @@ void CL_Rcon_f (void) { char message[1024]; - int len, i; netadr_t to; - snprintf (message, sizeof (message), "\377\377\377\377rcon %s ", - rcon_password->string); - len = strlen (message); - - for (i = 1; i < Cmd_Argc (); i++) { - strncat (message, Cmd_Argv (i), sizeof (message) - len - 1); - len += strlen (Cmd_Argv (i)); - strncat (message, " ", sizeof (message) - len - 1); - len += strlen (" "); - } + snprintf (message, sizeof (message), "\377\377\377\377rcon %s %s", + rcon_password->string, Cmd_Args (1)); if (cls.state >= ca_connected) to = cls.netchan.remote_address; diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 9af81aef5..fe187c434 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -927,9 +927,7 @@ Name_of_sender (void) void SVC_RemoteCommand (void) { - int i; - int len = 0; - char remaining[1024]; + const char *command; char *name; qboolean admin_cmd = false; qboolean do_cmd = false; @@ -966,21 +964,15 @@ SVC_RemoteCommand (void) } if (do_cmd) { - remaining[0] = 0; - - for (i = 2; i < Cmd_Argc (); i++) { - strncat (remaining, Cmd_Argv (i), sizeof (remaining) - len - 1); - strncat (remaining, " ", sizeof (remaining) - len - 2); - len += strlen (Cmd_Argv (i)) + 1; // +1 for " " - } + command = Cmd_Args (2); SV_Printf ("Rcon from %s:\n\trcon (hidden) %s\n", - NET_AdrToString (net_from), remaining); + NET_AdrToString (net_from), command); SV_BeginRedirect (RD_PACKET); if (name) rcon_from_user = true; - Cmd_ExecuteString (remaining, src_command); + Cmd_ExecuteString (command, src_command); rcon_from_user = false; } else { SV_Printf ("Bad rcon from %s:\n%s\n", NET_AdrToString (net_from),