# HG changeset patch # User tron # Date 1108715771 0 # Node ID 2a2ac927a256dbca9435d4189a627b3778572e9b # Parent 3837b6c645088b332441cb76d3323404e0d585c9 (svn r1886) Correctly process the last line of a script, even if it's not newline terminated. Also print an error message if something goes wrong while reading from the script file diff -r 3837b6c64508 -r 2a2ac927a256 console_cmds.c --- a/console_cmds.c Fri Feb 18 08:32:25 2005 +0000 +++ b/console_cmds.c Fri Feb 18 08:36:11 2005 +0000 @@ -609,10 +609,12 @@ _script_running = true; - fgets(cmd, sizeof(cmd), _script_file); - while (!feof(_script_file) && _script_running) { + while (_script_running && fgets(cmd, sizeof(cmd), _script_file) != NULL) { IConsoleCmdExec(cmd); - fgets(cmd, sizeof(cmd), _script_file); + } + + if (ferror(_script_file)) { + IConsoleError("Encountered errror while trying to read from script file"); } _script_running = false;