- if (n > 0) and (Buf2[n] = NewLine) then Dec (n);
Does this cope with famous <cr><lf> ? Jan
On Jan 28, 2005, at 08:16, Frank Heckenbach wrote:
Emil Jerabek wrote:
Incidentally, I tried it without --transparent-file-names (gpc 20041218, gcc 3.3.3), and got:
[~/pas]% ./a.out Input file `namebook': namebook ./a.out: cannot open file `namebook ' for reading (No such file or directory) (error #442 at 8049e79)
I.e., the name of the file includes the newline which is necessary to terminate the input! This is IMO another bug.
Yes, this bug slipped in when I ported the file handling from C to Pascal.
--- rts/files.pas.orig Sun Nov 14 04:38:58 2004 +++ rts/files.pas Fri Jan 28 14:16:01 2005 @@ -1154,7 +1154,7 @@ if Tty >= 0 then Discard (CloseHandle (Tty)); if (n > 0) and (Buf2[1] = EOT) then IOERROR_FILE (421, f, False, ''); { EOT character given for query of file name for %s }
- if (n > 0) and (Buf2[n] = '\n') then Dec (n);
- if (n > 0) and (Buf2[n] = NewLine) then Dec (n); Inc (n); Buf2[n] := #0; Tmp := InternalNew (n);
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8