From 499c3c20bd76a68cf770050134b76bd46e5cba35 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 18 Apr 2000 09:30:45 +0000 Subject: [PATCH] qargs.h: "share the software ..." put in an extern for com_cmdline qargs.c: no longer include the program name (argv[0]) in com_cmdline cmd.c: remove redundant code from Cmd_StuffCmds_f and use com_cmdline in it's place. --- common/cmd.c | 40 +++++++++++++--------------------------- common/qargs.c | 17 ++++++++++------- common/qargs.h | 1 + 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/common/cmd.c b/common/cmd.c index 942ece2..b27a37c 100644 --- a/common/cmd.c +++ b/common/cmd.c @@ -29,6 +29,7 @@ */ #include +#include #include #include #include @@ -230,57 +231,42 @@ void Cmd_StuffCmds_f (void) { int i, j; int s; - char *text, *build, c; + char *build, c; -// build the combined string to parse from - s = 0; - for (i=1 ; i 0); - strcat (com_cmdline, " "); + if (len) { + for (i=1; i < argc; i++) + { + strncat (com_cmdline, argv[i], len); + assert(len - strlen(com_cmdline) > 0); + strcat (com_cmdline, " "); + } + com_cmdline[len - 1] = '\0'; } - com_cmdline[len - 1] = '\0'; if (safe) { diff --git a/common/qargs.h b/common/qargs.h index a9034b4..498174a 100644 --- a/common/qargs.h +++ b/common/qargs.h @@ -35,6 +35,7 @@ extern int com_argc; extern char **com_argv; +extern char *com_cmdline; int COM_CheckParm (char *parm); void COM_AddParm (char *parm);