From f5de2f4d22469d7eed791a14cdc44b862f551c13 Mon Sep 17 00:00:00 2001 From: Timothe Litt Date: Wed, 29 May 2013 13:43:12 -0400 Subject: [PATCH] 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. --- PDP10/pdp10_lp20.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PDP10/pdp10_lp20.c b/PDP10/pdp10_lp20.c index fec1cda6..20858e10 100644 --- a/PDP10/pdp10_lp20.c +++ b/PDP10/pdp10_lp20.c @@ -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 */