From 73c0f213633d023ff8063766338b4747f48b946d Mon Sep 17 00:00:00 2001 From: tron Date: Thu, 17 Feb 2005 17:38:17 +0000 Subject: (svn r1883) -Fix: [1109400] Better test if a string actually contains any console command --- console.c | 12 ++++++++++-- console_cmds.c | 4 +--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/console.c b/console.c index 98019c9b6..598683cfc 100644 --- a/console.c +++ b/console.c @@ -1094,8 +1094,16 @@ void IConsoleCmdExec(const char* cmdstr) uint i; uint l; - if (strlen(cmdstr) == 0) // only execute if there is something typed obviously - return; + for (; strchr("\n\r \t", *cmdstr) != NULL; ++cmdstr) { + switch (*cmdstr) { + case '\0': + case '#': + return; + + default: + break; + } + } if (_stdlib_con_developer) IConsolePrintF(_iconsole_color_debug, "CONDEBUG: execution_cmdline: %s", cmdstr); diff --git a/console_cmds.c b/console_cmds.c index adf67f202..ab0364bfd 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -611,9 +611,7 @@ DEF_CONSOLE_CMD(ConExec) fgets(cmd, sizeof(cmd), _script_file); while (!feof(_script_file) && _script_running) { - strtok(cmd, "\r\n#"); - if (strlen(cmd) > 0 && cmd[0] != '#') - IConsoleCmdExec(cmd); + IConsoleCmdExec(cmd); fgets(cmd, sizeof(cmd), _script_file); } -- cgit v1.2.3-70-g09d2