diff -r 3c65326bb713 -r 3602ede67ec5 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Sat Apr 09 15:54:28 2011 -0400 +++ b/hedgewars/uUtils.pas Sun Apr 10 20:24:25 2011 +0400 @@ -338,23 +338,27 @@ if (ParamStr(1) <> '') and (ParamStr(2) <> '') then if (ParamCount <> 3) and (ParamCount <> cDefaultParamNum) then begin - for i:= 0 to 7 do + i:= 0; + while(i < 7) do begin assign(f, ExtractFileDir(ParamStr(2)) + '/' + cLogfileBase + inttostr(i) + '.log'); rewrite(f); if IOResult = 0 then break; + inc(i) end; - if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr + if i = 7 then f:= stderr; // if everything fails, write to stderr end else begin - for i:= 0 to 7 do + i:= 0; + while(i < 7) do begin assign(f, ParamStr(1) + '/Logs/' + cLogfileBase + inttostr(i) + '.log'); rewrite(f); if IOResult = 0 then break; + inc(i) end; - if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr + if i = 7 then f:= stderr; // if everything fails, write to stderr end else f:= stderr;