(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

pull/155/head
tron 20 years ago
parent 4118a32cff
commit 1804109f4b

@ -609,10 +609,12 @@ DEF_CONSOLE_CMD(ConExec)
_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;

Loading…
Cancel
Save