# HG changeset patch # User alberth # Date 2010-06-26 15:04:57 # Node ID 2c0be721dafc48b0b2a416b2fac9923bbd2e2aff # Parent 981e1d95560b1c56d23855fe06d12d05c7858fc2 (svn r20020) -Codechange: _script_file is used in only one function. diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -42,7 +42,6 @@ #endif /* ENABLE_NETWORK */ /* scriptfile handling */ -static FILE *_script_file; static bool _script_running; /* console command defines */ @@ -871,16 +870,16 @@ DEF_CONSOLE_CMD(ConExec) if (argc < 2) return false; - _script_file = FioFOpenFile(argv[1], "r", BASE_DIR); + FILE *script_file = FioFOpenFile(argv[1], "r", BASE_DIR); - if (_script_file == NULL) { + if (script_file == NULL) { if (argc == 2 || atoi(argv[2]) != 0) IConsoleError("script file not found"); return true; } _script_running = true; - while (_script_running && fgets(cmdline, sizeof(cmdline), _script_file) != NULL) { + while (_script_running && fgets(cmdline, sizeof(cmdline), script_file) != NULL) { /* Remove newline characters from the executing script */ for (cmdptr = cmdline; *cmdptr != '\0'; cmdptr++) { if (*cmdptr == '\n' || *cmdptr == '\r') { @@ -891,11 +890,11 @@ DEF_CONSOLE_CMD(ConExec) IConsoleCmdExec(cmdline); } - if (ferror(_script_file)) + if (ferror(script_file)) IConsoleError("Encountered errror while trying to read from script file"); _script_running = false; - FioFCloseFile(_script_file); + FioFCloseFile(script_file); return true; }