1
0
mirror of https://github.com/simh/simh.git synced 2026-02-11 18:46:08 +00:00

All LP and CD devices: Removed use of ftell for pipe compatibility

This commit is contained in:
Bob Supnik
2022-05-16 04:57:30 -07:00
committed by Mark Pizzolato
parent 5d04198757
commit e2d3a2ae70
17 changed files with 152 additions and 105 deletions

View File

@@ -1,6 +1,6 @@
/* h316_lp.c: Honeywell 316/516 line printer
Copyright (c) 1999-2015, Robert M. Supnik
Copyright (c) 1999-2021, Robert M. Supnik
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@@ -25,7 +25,8 @@
lpt line printer
03-Jul-13 RLA compatibility changes for extended interrupts
09-Jun-21 RMS Added error detection, removed use of ftell
03-Jul-13 RLA Compatibility changes for extended interrupts
09-Jun-07 RMS Fixed lost last print line (Theo Engel)
19-Jan-06 RMS Added UNIT_TEXT flag
03-Apr-06 RMS Fixed bug in blanks backscanning (Theo Engel)
@@ -320,7 +321,12 @@ if (lpt_svcst & LPT_SVCSH) { /* shuttling? */
}
lpt_buf[i + 1] = 0;
fputs (lpt_buf, uptr->fileref); /* output buf */
uptr->pos = ftell (uptr->fileref); /* update pos */
if (ferror (uptr->fileref)) { /* error? */
perror ("LPT I/O error");
clearerr (uptr->fileref);
return SCPE_IOERR;
}
uptr->pos = uptr->pos + strlen (lpt_buf); /* update pos */
for (i = 0; i < LPT_WIDTH; i++) /* clear buf */
lpt_buf[i] = ' ';
lpt_prdn = 1; /* print done */
@@ -329,7 +335,12 @@ if (lpt_svcst & LPT_SVCSH) { /* shuttling? */
if (lpt_svcst & LPT_SVCPA) { /* paper advance */
SET_INT (INT_LPT); /* interrupt */
fputs (lpt_cc[lpt_svcch & 03], uptr->fileref); /* output eol */
uptr->pos = ftell (uptr->fileref); /* update pos */
if (ferror (uptr->fileref)) { /* error? */
perror ("LPT I/O error");
clearerr (uptr->fileref);
return SCPE_IOERR;
}
uptr->pos = uptr->pos + strlen (lpt_cc[lpt_svcch & 03]); /* update pos */
}
lpt_svcst = 0;
return SCPE_OK;

View File

@@ -1,6 +1,6 @@
/* h316_stddev.c: Honeywell 316/516 standard devices
Copyright (c) 1999-2015, Robert M. Supnik
Copyright (c) 1999-2021, Robert M. Supnik
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@@ -28,6 +28,7 @@
tty 316/516-33 teleprinter
clk/options 316/516-12 real time clocks/internal options
20-Mar-21 RMS Reverted use of ftell for pipe compatibility
10-Sep-13 RMS Fixed several bugs in the TTY logic
Added SET file type commands to PTR/PTP
03-Jul-13 RLA compatibility changes for extended interrupts
@@ -407,7 +408,7 @@ else {
}
else if ((uptr->flags & UNIT_ASC) && (c != 0)) /* ASCII? */
c = c | 0200;
uptr->pos = ftell (uptr->fileref); /* update pos */
uptr->pos = uptr->pos + 1; /* update pos */
}
SET_INT (INT_PTR); /* set ready flag */
uptr->buf = c & 0377; /* get byte */
@@ -562,7 +563,7 @@ if (putc (c, uptr->fileref) == EOF) { /* output byte */
clearerr (uptr->fileref);
return SCPE_IOERR;
}
uptr->pos = ftell (uptr->fileref); /* update pos */
uptr->pos = uptr->pos + 1; /* update pos */
return SCPE_OK;
}
@@ -697,7 +698,7 @@ else if ((ruptr->flags & UNIT_ATT) && /* TTR attached */
}
else if ((ruptr->flags & UNIT_ASC) && (c != 0))
c = c | 0200; /* ASCII nz? cvt */
ruptr->pos = ftell (ruptr->fileref);
ruptr->pos = ruptr->pos + 1;
}
if (ttr_xoff_read != 0) { /* reader stopping? */
if (c == RUBOUT) /* rubout? stop */
@@ -801,7 +802,7 @@ if ((puptr->flags & UNIT_ATT) && /* TTP attached */
clearerr (puptr->fileref);
return SCPE_IOERR;
}
puptr->pos = ftell (puptr->fileref); /* update pos */
puptr->pos = puptr->pos + 1; /* update pos */
}
}
return SCPE_OK;