LP20 emulation was overwriting existing files

When an LP20 is attached to an existing file, the file is opened in
update mode.  Since the initial file position is zero, any existing
output is over-written.  This is not intuitive.

This edit makes the LP20 seek to EOF on attach.

N.B. Other devices may have cousin issues.
This commit is contained in:
Timothe Litt 2013-05-29 13:43:12 -04:00
parent 27dac1ade2
commit f5de2f4d22

View file

@ -25,6 +25,8 @@
lp20 line printer
29-May-13 TL Force append when an existing file is attached. Previously
over-wrote file from the top.
19-Jan-07 RMS Added UNIT_TEXT flag
04-Sep-05 RMS Fixed missing return (found by Peter Schorn)
07-Jul-05 RMS Removed extraneous externs
@ -657,6 +659,10 @@ t_stat lp20_attach (UNIT *uptr, char *cptr)
t_stat reason;
reason = attach_unit (uptr, cptr); /* attach file */
if (reason == SCPE_OK) {
sim_fseek (uptr->fileref, 0, SEEK_END);
uptr->pos = ftell (uptr->fileref);
}
if (lpcsa & CSA_ONL) /* just file chg? */
return reason;
if (sim_is_active (&lp20_unit)) /* busy? no int */