1
0
mirror of https://github.com/simh/simh.git synced 2026-02-12 19:08:41 +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 @@
/* i7094_cd.c: IBM 711/721 card reader/punch
Copyright (c) 2003-2017, Robert M. Supnik
Copyright (c) 2003-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"),
@@ -26,6 +26,7 @@
cdr 711 card reader
cdp 721 card punch
09-Jun-21 RMS Removed use of ftell on output for pipe compatibility
13-Mar-17 RMS Annotated fall through in switch
19-Mar-12 RMS Fixed declaration of sim_switches (Mark Pizzolato)
19-Jan-07 RMS Added UNIT_TEXT
@@ -455,12 +456,12 @@ for (i = ((2 * CD_CHRLNT) + 1); (i > 0) &&
cdp_cbuf[i++] = '\n'; /* append nl */
cdp_cbuf[i++] = 0; /* append nul */
fputs (cdp_cbuf, uptr->fileref); /* write card */
uptr->pos = ftell (uptr->fileref); /* update position */
if (ferror (uptr->fileref)) { /* error? */
perror ("CDP I/O error");
clearerr (uptr->fileref);
return SCPE_IOERR;
}
uptr->pos = uptr->pos + strlen (cdp_cbuf); /* update position */
cdp_sta = CDS_END; /* end state */
sim_cancel (uptr); /* cancel current */
sim_activate (uptr, cdp_tstop); /* long timer */

View File

@@ -1,6 +1,6 @@
/* i7094_lp.c: IBM 716 line printer simulator
Copyright (c) 2003-2017, Robert M. Supnik
Copyright (c) 2003-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,6 +25,7 @@
lpt 716 line printer
09-Jun-21 RMS Removed use of ftell for pipe compatibility
13-Mar-17 RMS Fixed GET_PCHAIN macro (COVERITY)
19-Jan-07 RMS Added UNIT_TEXT flag
@@ -338,12 +339,12 @@ lpt_cbuf[i] = 0; /* append nul */
if (uptr->flags & UNIT_ATT) { /* file? */
fputs (lpt_cbuf, uptr->fileref); /* write line */
fputc ('\n', uptr->fileref); /* append nl */
uptr->pos = ftell (uptr->fileref); /* update position */
if (ferror (uptr->fileref)) { /* error? */
perror ("LPT I/O error");
clearerr (uptr->fileref);
return SCPE_IOERR;
}
uptr->pos = uptr->pos + strlen (lpt_cbuf) + 1; /* update pos, add nl */
}
else if (uptr->flags & UNIT_CONS) { /* print to console? */
for (i = 0; lpt_cbuf[i] != 0; i++)