Changeset - r1382:3f9f490fc3e6
[Not reviewed]
master
0 1 0
tron - 19 years ago 2005-02-18 08:36:11
tron@openttd.org
(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
1 file changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
console_cmds.c
Show inline comments
 
@@ -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;
0 comments (0 inline, 0 general)