diff --git a/GRI/gri_stddev.c b/GRI/gri_stddev.c index b05fc6cd..62c22304 100644 --- a/GRI/gri_stddev.c +++ b/GRI/gri_stddev.c @@ -347,7 +347,7 @@ if ((temp = getc (hsr_unit.fileref)) == EOF) { /* read char */ sim_printf ("HSR end of file\n"); else return SCPE_OK; } - else perror ("HSR I/O error"); + else sim_perror ("HSR I/O error"); clearerr (hsr_unit.fileref); return SCPE_IOERR; } @@ -363,7 +363,7 @@ dev_done = dev_done | INT_HSP; /* set ready */ if ((hsp_unit.flags & UNIT_ATT) == 0) /* attached? */ return IORETURN (hsp_stopioe, SCPE_UNATT); if (putc (hsp_unit.buf, hsp_unit.fileref) == EOF) { /* write char */ - perror ("HSP I/O error"); /* error? */ + sim_perror ("HSP I/O error"); /* error? */ clearerr (hsp_unit.fileref); return SCPE_IOERR; } diff --git a/H316/h316_dp.c b/H316/h316_dp.c index ac0145c7..9f43e3b9 100644 --- a/H316/h316_dp.c +++ b/H316/h316_dp.c @@ -793,7 +793,7 @@ l = fxread (buf, sizeof (uint16), DP_TRKLEN, uptr->fileref); for ( ; l < DP_TRKLEN; l++) buf[l] = 0; if (ferror (uptr->fileref)) { - perror ("DP I/O error"); + sim_perror ("DP I/O error"); clearerr (uptr->fileref); dp_done (1, STA_UNSER); return SCPE_IOERR; @@ -810,7 +810,7 @@ uint32 da = ((c * dp_tab[dp_ctype].surf) + h) * DP_TRKLEN; fseek (uptr->fileref, da * sizeof (uint16), SEEK_SET); fxwrite (buf, sizeof (uint16), DP_TRKLEN, uptr->fileref); if (ferror (uptr->fileref)) { - perror ("DP I/O error"); + sim_perror ("DP I/O error"); clearerr (uptr->fileref); dp_done (1, STA_UNSER); return SCPE_IOERR; diff --git a/H316/h316_stddev.c b/H316/h316_stddev.c index 0e69c782..b618d2b0 100644 --- a/H316/h316_stddev.c +++ b/H316/h316_stddev.c @@ -398,7 +398,7 @@ else { sim_printf ("PTR end of file\n"); else return SCPE_OK; } - else perror ("PTR I/O error"); + else sim_perror ("PTR I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -559,7 +559,7 @@ if (uptr->flags & UNIT_ASC) { /* ASCII? */ } else c = uptr->buf & 0377; /* no, binary */ if (putc (c, uptr->fileref) == EOF) { /* output byte */ - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -689,7 +689,7 @@ else if ((ruptr->flags & UNIT_ATT) && /* TTR attached */ sim_printf ("TTR end of file\n"); else return SCPE_OK; } - else perror ("TTR I/O error"); + else sim_perror ("TTR I/O error"); clearerr (ruptr->fileref); return SCPE_IOERR; } @@ -799,7 +799,7 @@ if ((puptr->flags & UNIT_ATT) && /* TTP attached */ } else p = c; /* untouched */ if (putc (p, puptr->fileref) == EOF) { /* output byte */ - perror ("TTP I/O error"); + sim_perror ("TTP I/O error"); clearerr (puptr->fileref); return SCPE_IOERR; } diff --git a/I1401/i1401_cd.c b/I1401/i1401_cd.c index 1a56f930..a3436043 100644 --- a/I1401/i1401_cd.c +++ b/I1401/i1401_cd.c @@ -295,7 +295,7 @@ if ((uptr->flags & UNIT_ATT) == 0) /* attached? */ fputs (cdr_buf, uptr->fileref); /* write card */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("Card stacker I/O error"); + sim_perror ("Card stacker I/O error"); clearerr (uptr->fileref); if (iochk) return SCPE_IOERR; @@ -375,7 +375,7 @@ fputs (cdp_buf, uptr->fileref); /* output card */ fputc ('\n', uptr->fileref); /* plus new line */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("Card punch I/O error"); + sim_perror ("Card punch I/O error"); clearerr (uptr->fileref); if (iochk) return SCPE_IOERR; @@ -413,7 +413,7 @@ if (feof (cdr_unit.fileref)) /* eof? */ return STOP_NOCD; if (ferror (cdr_unit.fileref)) { /* error? */ ind[IN_READ] = 1; - perror ("Card reader I/O error"); + sim_perror ("Card reader I/O error"); clearerr (cdr_unit.fileref); if (iochk) return SCPE_IOERR; diff --git a/I1401/i1401_lp.c b/I1401/i1401_lp.c index 64dd2522..788dd9d4 100644 --- a/I1401/i1401_lp.c +++ b/I1401/i1401_lp.c @@ -246,7 +246,7 @@ if ((lpt_unit.flags & UNIT_ATT) != 0) { /* attached? */ fputs (buf, lpt_unit.fileref); /* print string */ if (ferror (lpt_unit.fileref)) { /* error? */ ind[IN_LPT] = 1; - perror ("Line printer I/O error"); + sim_perror ("Line printer I/O error"); clearerr (lpt_unit.fileref); if (iochk) return SCPE_IOERR; diff --git a/I7094/i7094_cd.c b/I7094/i7094_cd.c index 9b286653..e0aef9e9 100644 --- a/I7094/i7094_cd.c +++ b/I7094/i7094_cd.c @@ -227,7 +227,7 @@ switch (cdr_sta) { /* case on state */ if (feof (uptr->fileref)) /* eof? */ return ch6_err_disc (CH_A, U_CDR, CHF_EOF); /* set EOF, disc */ if (ferror (uptr->fileref)) { /* error? */ - perror ("CDR I/O error"); + sim_perror ("CDR I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; /* stop */ } @@ -456,7 +456,7 @@ 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"); + sim_perror ("CDP I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/I7094/i7094_dsk.c b/I7094/i7094_dsk.c index d5b30c3d..96059730 100644 --- a/I7094/i7094_dsk.c +++ b/I7094/i7094_dsk.c @@ -888,7 +888,7 @@ da = DSK_DA (dsk_acc, trk, dtyp); /* get disk address */ sim_fseek (udptr->fileref, da, SEEK_SET); /* read track */ k = sim_fread (dsk_buf, sizeof (t_uint64), dsk_tab[dtyp].wdspt, udptr->fileref); if (ferror (udptr->fileref)) { /* error? */ - perror ("DSK I/O error"); + sim_perror ("DSK I/O error"); clearerr (udptr->fileref); dsk_uend (dsk_ch, DSKS_DSKE); return SCPE_IOERR; @@ -989,7 +989,7 @@ uint32 da = DSK_DA (dsk_acc, trk, dtyp); sim_fseek (udptr->fileref, da, SEEK_SET); sim_fwrite (dsk_buf, sizeof (t_uint64), dsk_tab[dtyp].wdspt, udptr->fileref); if (ferror (udptr->fileref)) { - perror ("DSK I/O error"); + sim_perror ("DSK I/O error"); clearerr (udptr->fileref); dsk_uend (dsk_ch, DSKS_DSKE); return SCPE_IOERR; diff --git a/I7094/i7094_lp.c b/I7094/i7094_lp.c index f6aca08c..9fb56ee8 100644 --- a/I7094/i7094_lp.c +++ b/I7094/i7094_lp.c @@ -340,7 +340,7 @@ if (uptr->flags & UNIT_ATT) { /* file? */ fputc ('\n', uptr->fileref); /* append nl */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/Ibm1130/ibm1130_cpu.c b/Ibm1130/ibm1130_cpu.c index 33d139e7..7e0a2e02 100644 --- a/Ibm1130/ibm1130_cpu.c +++ b/Ibm1130/ibm1130_cpu.c @@ -1704,7 +1704,7 @@ static t_stat cpu_attach (UNIT *uptr, char *cptr) return SCPE_ARG; } if ((fd = fopen(mapfile, "r")) == NULL) { - perror(mapfile); + sim_perror(mapfile); return SCPE_OPENERR; } diff --git a/Ibm1130/ibm1130_prt.c b/Ibm1130/ibm1130_prt.c index fcee8713..f807afde 100644 --- a/Ibm1130/ibm1130_prt.c +++ b/Ibm1130/ibm1130_prt.c @@ -662,7 +662,7 @@ static t_stat delete_cmd (int32 flag, char *cptr) status = remove(gbuf); /* delete the file */ if (status != 0 && errno != ENOENT) /* print message if failed and file exists */ - perror(gbuf); + sim_perror(gbuf); return SCPE_OK; } diff --git a/Interdata/id_dp.c b/Interdata/id_dp.c index 792c37e8..65887b04 100644 --- a/Interdata/id_dp.c +++ b/Interdata/id_dp.c @@ -463,7 +463,7 @@ i = fxread (dpxb, sizeof (uint8), DP_NUMBY, uptr->fileref); for ( ; i < DP_NUMBY; i++) /* fill with 0's */ dpxb[i] = 0; if (ferror (uptr->fileref)) { /* error? */ - perror ("DP I/O error"); + sim_perror ("DP I/O error"); clearerr (uptr->fileref); dp_done (STC_DTE); return SCPE_IOERR; @@ -479,7 +479,7 @@ for ( ; dp_bptr < DP_NUMBY; dp_bptr++) dpxb[dp_bptr] = dp_db; /* fill with last */ fxwrite (dpxb, sizeof (uint8), DP_NUMBY, uptr->fileref); if (ferror (uptr->fileref)) { /* error? */ - perror ("DP I/O error"); + sim_perror ("DP I/O error"); clearerr (uptr->fileref); dp_done (STC_DTE); return SCPE_IOERR; diff --git a/Interdata/id_idc.c b/Interdata/id_idc.c index 42a9b02a..dae22f3e 100644 --- a/Interdata/id_idc.c +++ b/Interdata/id_idc.c @@ -657,7 +657,7 @@ uint32 i; i = fxread (idcxb, sizeof (uint8), IDC_NUMBY, uptr->fileref); if (ferror (uptr->fileref)) { /* error? */ - perror ("IDC I/O error"); + sim_perror ("IDC I/O error"); clearerr (uptr->fileref); idc_done (STC_DTE); return SCPE_IOERR; @@ -675,7 +675,7 @@ for ( ; idc_bptr < IDC_NUMBY; idc_bptr++) idcxb[idc_bptr] = idc_db; /* fill with last */ fxwrite (idcxb, sizeof (uint8), IDC_NUMBY, uptr->fileref); if (ferror (uptr->fileref)) { /* error? */ - perror ("IDC I/O error"); + sim_perror ("IDC I/O error"); clearerr (uptr->fileref); idc_done (STC_DTE); return SCPE_IOERR; diff --git a/Interdata/id_lp.c b/Interdata/id_lp.c index fcb1c09b..18754c08 100644 --- a/Interdata/id_lp.c +++ b/Interdata/id_lp.c @@ -185,7 +185,7 @@ if (lpt_spnd || ((t >= LF) && (t < CR))) { /* spc pend or spc op? * else fputs ("\r", uptr->fileref); /* overprint */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (lpt_unit.fileref)) { - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -217,7 +217,7 @@ if (lpxb[0]) { /* any char left? */ fputs (lpxb, uptr->fileref); /* write line */ lpt_unit.pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); r = SCPE_IOERR; } diff --git a/Interdata/id_pt.c b/Interdata/id_pt.c index 3f4dedee..36b9d75f 100644 --- a/Interdata/id_pt.c +++ b/Interdata/id_pt.c @@ -207,7 +207,7 @@ if ((temp = getc (uptr->fileref)) == EOF) { /* error? */ sim_printf ("PTR end of file\n"); else return SCPE_OK; } - else perror ("PTR I/O error"); + else sim_perror ("PTR I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -228,7 +228,7 @@ if (!pt_rd) { /* write mode? */ SET_INT (v_PT); } if (putc (uptr->buf, uptr -> fileref) == EOF) { /* write char */ - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (uptr -> fileref); return SCPE_IOERR; } diff --git a/LGP/lgp_stddev.c b/LGP/lgp_stddev.c index 80657ab1..c527dd77 100644 --- a/LGP/lgp_stddev.c +++ b/LGP/lgp_stddev.c @@ -504,7 +504,7 @@ do { sim_printf ("Reader end of file\n"); else return SCPE_OK; } - else perror ("Reader I/O error"); + else sim_perror ("Reader I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -519,7 +519,7 @@ do { sim_printf ("Reader end of file\n"); else return SCPE_OK; } - else perror ("Reader I/O error"); + else sim_perror ("Reader I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -570,7 +570,7 @@ if (c >= 0) /* valid? */ sta = fputc (c, uptr->fileref); else sta = fprintf (uptr->fileref, "!%02d", flex); /* no, encode */ if (sta == EOF) { /* error? */ - perror ("Punch I/O error"); /* error? */ + sim_perror ("Punch I/O error"); /* error? */ clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/NOVA/nova_dkp.c b/NOVA/nova_dkp.c index c9d50cec..224d885e 100644 --- a/NOVA/nova_dkp.c +++ b/NOVA/nova_dkp.c @@ -930,7 +930,7 @@ do { } if (err != 0) { - perror ("DKP I/O error"); + sim_perror ("DKP I/O error"); clearerr (uptr->fileref); rval = SCPE_IOERR; break ; diff --git a/NOVA/nova_lp.c b/NOVA/nova_lp.c index c2e3923c..638625ac 100644 --- a/NOVA/nova_lp.c +++ b/NOVA/nova_lp.c @@ -134,7 +134,7 @@ if ((lpt_unit.flags & UNIT_ATT) == 0) /* attached? */ fputc (uptr->buf, uptr->fileref); uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/NOVA/nova_plt.c b/NOVA/nova_plt.c index d24d6a97..5ded9be2 100644 --- a/NOVA/nova_plt.c +++ b/NOVA/nova_plt.c @@ -139,7 +139,7 @@ DEV_UPDATE_INTR ; if ((plt_unit.flags & UNIT_ATT) == 0) /* attached? */ return IORETURN (plt_stopioe, SCPE_UNATT); if (putc (plt_unit.buf, plt_unit.fileref) == EOF) { - perror ("PLT I/O error"); + sim_perror ("PLT I/O error"); clearerr (plt_unit.fileref); return SCPE_IOERR; } diff --git a/NOVA/nova_pt.c b/NOVA/nova_pt.c index c4517edb..4aebf527 100644 --- a/NOVA/nova_pt.c +++ b/NOVA/nova_pt.c @@ -197,7 +197,7 @@ if ((temp = getc (ptr_unit.fileref)) == EOF) { /* end of file? */ sim_printf ("PTR end of file\n"); else return SCPE_OK; } - else perror ("PTR I/O error"); + else sim_perror ("PTR I/O error"); clearerr (ptr_unit.fileref); return SCPE_IOERR; } @@ -277,7 +277,7 @@ DEV_UPDATE_INTR ; if ((ptp_unit.flags & UNIT_ATT) == 0) /* attached? */ return IORETURN (ptp_stopioe, SCPE_UNATT); if (putc ((ptp_unit.buf & ((ptp_unit.flags & UNIT_8B)? 0377: 0177)), ptp_unit.fileref) == EOF) { - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (ptp_unit.fileref); return SCPE_IOERR; } diff --git a/PDP1/pdp1_dt.c b/PDP1/pdp1_dt.c index f9bd69a5..a2ecc79e 100644 --- a/PDP1/pdp1_dt.c +++ b/PDP1/pdp1_dt.c @@ -1112,7 +1112,7 @@ if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) { /* any data? */ else fxwrite (uptr->filebuf, sizeof (uint32), /* write file */ uptr->hwmark, uptr->fileref); if (ferror (uptr->fileref)) - perror ("I/O error"); + sim_perror ("I/O error"); } /* end if hwmark */ free (uptr->filebuf); /* release buf */ uptr->flags = uptr->flags & ~UNIT_BUF; /* clear buf flag */ diff --git a/PDP1/pdp1_lp.c b/PDP1/pdp1_lp.c index ae5fe6c1..c3ec4aae 100644 --- a/PDP1/pdp1_lp.c +++ b/PDP1/pdp1_lp.c @@ -169,7 +169,7 @@ if (lpt_spc) { /* space? */ fputs (lpt_cc[lpt_spc & 07], uptr->fileref); /* print cctl */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -184,7 +184,7 @@ else { fputs (lpt_buf, uptr->fileref); /* print buffer */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* test error */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP1/pdp1_stddev.c b/PDP1/pdp1_stddev.c index a2f64cef..1537c196 100644 --- a/PDP1/pdp1_stddev.c +++ b/PDP1/pdp1_stddev.c @@ -347,7 +347,7 @@ if (temp == EOF) { /* end of file? */ sim_printf ("PTR end of file\n"); else return SCPE_OK; } - else perror ("PTR I/O error"); + else sim_perror ("PTR I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -510,7 +510,7 @@ dev_req_int (ptp_sbs); /* req interrupt */ if ((uptr->flags & UNIT_ATT) == 0) /* not attached? */ return IORETURN (ptp_stopioe, SCPE_UNATT); if (putc (uptr->buf, uptr->fileref) == EOF) { /* I/O error? */ - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP10/pdp10_lp20.c b/PDP10/pdp10_lp20.c index 9c2cc284..fa941d96 100644 --- a/PDP10/pdp10_lp20.c +++ b/PDP10/pdp10_lp20.c @@ -734,7 +734,7 @@ if (lpbc) /* intr, but not done */ update_lpcs (CSA_MBZ); else update_lpcs (CSA_DONE); /* intr and done */ if ((fnc == FNC_PR) && ferror (lp20_unit.fileref)) { - perror ("LP I/O error"); + sim_perror ("LP I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP10/pdp10_rp.c b/PDP10/pdp10_rp.c index a8049ab9..bfe5b41e 100644 --- a/PDP10/pdp10_rp.c +++ b/PDP10/pdp10_rp.c @@ -1024,7 +1024,7 @@ switch (uptr->FUNC) { /* case on function */ if (err != 0) { /* error? */ set_rper (ER1_PAR, drv); /* set drive error */ update_rpcs (CS1_DONE | CS1_TRE, drv); /* set done, err */ - perror ("RP I/O error"); + sim_perror ("RP I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP11/pdp11_hk.c b/PDP11/pdp11_hk.c index 8c7cb971..45a8039a 100644 --- a/PDP11/pdp11_hk.c +++ b/PDP11/pdp11_hk.c @@ -1222,7 +1222,7 @@ switch (fnc) { /* case on function */ if (err != 0) { /* error? */ hk_err (CS1_ERR|CS1_DONE, 0, ER_PAR, drv); /* set drive error */ - perror ("HK I/O error"); + sim_perror ("HK I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP11/pdp11_lp.c b/PDP11/pdp11_lp.c index 0a98c0cd..19c4aa58 100644 --- a/PDP11/pdp11_lp.c +++ b/PDP11/pdp11_lp.c @@ -167,7 +167,7 @@ if ((uptr->flags & UNIT_ATT) == 0) fputc (uptr->buf & 0177, uptr->fileref); uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP11/pdp11_pt.c b/PDP11/pdp11_pt.c index f5c27426..db190a44 100644 --- a/PDP11/pdp11_pt.c +++ b/PDP11/pdp11_pt.c @@ -245,7 +245,7 @@ if ((temp = getc (ptr_unit.fileref)) == EOF) { sim_printf ("PTR end of file\n"); else return SCPE_OK; } - else perror ("PTR I/O error"); + else sim_perror ("PTR I/O error"); clearerr (ptr_unit.fileref); return SCPE_IOERR; } @@ -341,7 +341,7 @@ if (ptp_csr & CSR_IE) if ((ptp_unit.flags & UNIT_ATT) == 0) return IORETURN (ptp_stopioe, SCPE_UNATT); if (putc (ptp_unit.buf, ptp_unit.fileref) == EOF) { - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (ptp_unit.fileref); return SCPE_IOERR; } diff --git a/PDP11/pdp11_rk.c b/PDP11/pdp11_rk.c index 65a64293..ca185abd 100644 --- a/PDP11/pdp11_rk.c +++ b/PDP11/pdp11_rk.c @@ -767,7 +767,7 @@ rkda = (rkda & RKDA_DRIVE) | (track << RKDA_V_TRACK) | (sect << RKDA_V_SECT); rk_set_done (0); if (err != 0) { /* error? */ - perror ("RK I/O error"); + sim_perror ("RK I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP11/pdp11_rl.c b/PDP11/pdp11_rl.c index b5f7e3af..df36635b 100644 --- a/PDP11/pdp11_rl.c +++ b/PDP11/pdp11_rl.c @@ -953,7 +953,7 @@ if (GET_SECT (uptr->TRK) >= RL_NUMSC) rl_set_done (0); if (err != 0) { /* error? */ - perror ("RL I/O error"); + sim_perror ("RL I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP11/pdp11_rp.c b/PDP11/pdp11_rp.c index eb2ce78d..bcd9e06a 100644 --- a/PDP11/pdp11_rp.c +++ b/PDP11/pdp11_rp.c @@ -1252,7 +1252,7 @@ else { /* Bottom End (After I/O processing) */ rp_set_er (ER1_PAR, drv); /* set drive error */ mba_set_exc (dibp->ba); /* set exception */ rp_update_ds (DS_ATA, drv); - perror ("RP I/O error"); + sim_perror ("RP I/O error"); return SCPE_IOERR; } diff --git a/PDP11/pdp11_tc.c b/PDP11/pdp11_tc.c index ebfdb425..5bb03a81 100644 --- a/PDP11/pdp11_tc.c +++ b/PDP11/pdp11_tc.c @@ -1333,7 +1333,7 @@ if (uptr->WRITTEN && uptr->hwmark && ((uptr->flags & UNIT_RO)== 0)) { /* any fxwrite (uptr->filebuf, sizeof (uint32), /* write file */ uptr->hwmark, uptr->fileref); if (ferror (uptr->fileref)) - perror ("I/O error"); + sim_perror ("I/O error"); } uptr->WRITTEN = FALSE; /* no longer dirty */ } diff --git a/PDP11/pdp11_tq.c b/PDP11/pdp11_tq.c index 0c083929..5724ef0e 100644 --- a/PDP11/pdp11_tq.c +++ b/PDP11/pdp11_tq.c @@ -1497,7 +1497,7 @@ t_stat tq_mot_err (UNIT *uptr, uint32 rsiz) uptr->flags = (uptr->flags | UNIT_SXC) & ~UNIT_TMK; /* serious exception */ if (tq_dte (uptr, ST_DRV)) /* post err log */ tq_mot_end (uptr, EF_LOG, ST_DRV, rsiz); /* if ok, report err */ -perror ("TQ I/O error"); +sim_perror ("TQ I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP18B/pdp18b_dt.c b/PDP18B/pdp18b_dt.c index 151b044d..8cfcc276 100644 --- a/PDP18B/pdp18b_dt.c +++ b/PDP18B/pdp18b_dt.c @@ -1528,7 +1528,7 @@ if (uptr->WRITTEN && uptr->hwmark && ((uptr->flags & UNIT_RO)== 0)) { /* any fxwrite (uptr->filebuf, sizeof (uint32), /* write file */ uptr->hwmark, uptr->fileref); if (ferror (uptr->fileref)) - perror ("I/O error"); + sim_perror ("I/O error"); } uptr->WRITTEN = FALSE; /* no longer dirty */ } diff --git a/PDP18B/pdp18b_lp.c b/PDP18B/pdp18b_lp.c index 801f05f1..7588ff09 100644 --- a/PDP18B/pdp18b_lp.c +++ b/PDP18B/pdp18b_lp.c @@ -185,7 +185,7 @@ if (lp62_spc) { /* space? */ fputs (lp62_cc[lp62_spc & 07], uptr->fileref); /* print cctl */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -200,7 +200,7 @@ else { fputs (lp62_buf, uptr->fileref); /* print buffer */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* test error */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -427,7 +427,7 @@ if ((lp647_iot & 020) == 0) { /* print? */ fputs (pbuf, uptr->fileref); /* print buffer */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); lp647_bp = 0; return SCPE_IOERR; @@ -438,7 +438,7 @@ if (lp647_iot & 060) { /* space? */ fputs (lp647_cc[lp647_iot & 07], uptr->fileref); /* write cctl */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -610,7 +610,7 @@ if ((c == 0) || (c == 0177)) /* skip NULL, DEL */ fputc (c, uptr->fileref); /* print char */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } @@ -824,7 +824,7 @@ for (more = 1; more != 0; ) { /* loop until ctrl */ fputs (ctrl[c[i]], uptr->fileref); /* space */ uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { /* error? */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); lp15_bp = 0; lp15_updsta (STA_DON | STA_ALM); diff --git a/PDP18B/pdp18b_rp.c b/PDP18B/pdp18b_rp.c index e1a0755d..398061da 100644 --- a/PDP18B/pdp18b_rp.c +++ b/PDP18B/pdp18b_rp.c @@ -432,7 +432,7 @@ rp_busy = 0; /* clear busy */ rp_updsta (STA_DON, 0); /* set done */ if (err != 0) { /* error? */ - perror ("RP I/O error"); + sim_perror ("RP I/O error"); clearerr (uptr->fileref); return IORETURN (rp_stopioe, SCPE_IOERR); } diff --git a/PDP18B/pdp18b_stddev.c b/PDP18B/pdp18b_stddev.c index 4b202d31..5d217714 100644 --- a/PDP18B/pdp18b_stddev.c +++ b/PDP18B/pdp18b_stddev.c @@ -576,7 +576,7 @@ if ((temp = getc (ptr_unit.fileref)) == EOF) { /* end of file? */ sim_printf ("PTR end of file\n"); else return SCPE_OK; } - else perror ("PTR I/O error"); + else sim_perror ("PTR I/O error"); clearerr (ptr_unit.fileref); return SCPE_IOERR; } @@ -918,7 +918,7 @@ if (ptp_unit.flags & UNIT_PASCII) { /* ASCII mode? */ } if (putc (ptp_unit.buf, ptp_unit.fileref) == EOF) { /* I/O error? */ ptp_err = 1; /* set error */ - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (ptp_unit.fileref); return SCPE_IOERR; } diff --git a/PDP8/pdp8_dt.c b/PDP8/pdp8_dt.c index 69fa5e97..e9f85aa3 100644 --- a/PDP8/pdp8_dt.c +++ b/PDP8/pdp8_dt.c @@ -1312,7 +1312,7 @@ if (uptr->WRITTEN && uptr->hwmark && ((uptr->flags & UNIT_RO)== 0)) { /* any } /* end loop buf */ } /* end else */ if (ferror (uptr->fileref)) - perror ("I/O error"); + sim_perror ("I/O error"); } uptr->WRITTEN = FALSE; /* no longer dirty */ } diff --git a/PDP8/pdp8_lp.c b/PDP8/pdp8_lp.c index 6c111367..98db6c12 100644 --- a/PDP8/pdp8_lp.c +++ b/PDP8/pdp8_lp.c @@ -143,7 +143,7 @@ if ((uptr->flags & UNIT_ATT) == 0) { fputc (uptr->buf, uptr->fileref); /* print char */ uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { /* error? */ - perror ("LPT I/O error"); + sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP8/pdp8_pt.c b/PDP8/pdp8_pt.c index 01c8bbae..f8dca656 100644 --- a/PDP8/pdp8_pt.c +++ b/PDP8/pdp8_pt.c @@ -167,7 +167,7 @@ if ((temp = getc (ptr_unit.fileref)) == EOF) { sim_printf ("PTR end of file\n"); else return SCPE_OK; } - else sim_printf ("PTR I/O error: %d\n", errno); + else sim_perror ("PTR I/O error"); clearerr (ptr_unit.fileref); return SCPE_IOERR; } @@ -231,7 +231,7 @@ int_req = INT_UPDATE; /* update interrupts */ if ((ptp_unit.flags & UNIT_ATT) == 0) /* attached? */ return IORETURN (ptp_stopioe, SCPE_UNATT); if (putc (ptp_unit.buf, ptp_unit.fileref) == EOF) { - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (ptp_unit.fileref); return SCPE_IOERR; } diff --git a/PDP8/pdp8_rk.c b/PDP8/pdp8_rk.c index ef057a0b..3d692b00 100644 --- a/PDP8/pdp8_rk.c +++ b/PDP8/pdp8_rk.c @@ -408,7 +408,7 @@ rk_busy = 0; RK_INT_UPDATE; if (err != 0) { - perror ("RK I/O error"); + sim_perror ("RK I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP8/pdp8_rl.c b/PDP8/pdp8_rl.c index d078a9de..e1a47f1a 100644 --- a/PDP8/pdp8_rl.c +++ b/PDP8/pdp8_rl.c @@ -521,7 +521,7 @@ rlsa = rlsa + ((bc + (RL_NUMBY - 1)) / RL_NUMBY); rl_set_done (0); if (err != 0) { /* error? */ - perror ("RL I/O error"); + sim_perror ("RL I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/PDP8/pdp8_td.c b/PDP8/pdp8_td.c index 5fd06746..1b3b5497 100644 --- a/PDP8/pdp8_td.c +++ b/PDP8/pdp8_td.c @@ -893,7 +893,7 @@ if (uptr->WRITTEN && uptr->hwmark && ((uptr->flags & UNIT_RO)== 0)) { /* any } /* end loop buf */ } /* end else */ if (ferror (uptr->fileref)) - perror ("I/O error"); + sim_perror ("I/O error"); } uptr->WRITTEN = FALSE; /* no longer dirty */ } diff --git a/S3/s3_cd.c b/S3/s3_cd.c index 7c5b2423..0a335164 100644 --- a/S3/s3_cd.c +++ b/S3/s3_cd.c @@ -311,7 +311,7 @@ if (feof (cdr_unit.fileref)) { /* eof? */ return STOP_NOCD; } if (ferror (cdr_unit.fileref)) { /* error? */ - perror ("Card reader I/O error"); + sim_perror ("Card reader I/O error"); clearerr (cdr_unit.fileref); carderr = 1; return SCPE_OK; } @@ -352,7 +352,7 @@ rbuf[CDR_WIDTH] = 0; /* null at end */ fputs (rbuf, uptr -> fileref); /* write card */ fputc ('\n', uptr -> fileref); /* plus new line */ if (ferror (uptr -> fileref)) { /* error? */ - perror ("Card stacker I/O error"); + sim_perror ("Card stacker I/O error"); clearerr (uptr -> fileref); } uptr -> pos = ftell (uptr -> fileref); /* update position */ @@ -397,7 +397,7 @@ if (!cdp_ebcdic) { } } if (ferror (uptr -> fileref)) { /* error? */ - perror ("Card punch I/O error"); + sim_perror ("Card punch I/O error"); clearerr (uptr -> fileref); pcherror = 1; } diff --git a/S3/s3_lp.c b/S3/s3_lp.c index a0507f50..ff1fa307 100644 --- a/S3/s3_lp.c +++ b/S3/s3_lp.c @@ -240,7 +240,7 @@ else { } lines = lflag = 0; /* clear cc action */ if (ferror (lpt_unit.fileref)) { /* error? */ - perror ("Line printer I/O error"); + sim_perror ("Line printer I/O error"); clearerr (lpt_unit.fileref); lpterror = 1; } diff --git a/SAGE/sage_lp.c b/SAGE/sage_lp.c index 201ac177..698ef078 100644 --- a/SAGE/sage_lp.c +++ b/SAGE/sage_lp.c @@ -234,7 +234,7 @@ static t_stat sagelp_output(UNIT *uptr) if ((u39.portc & U39C_STROBE)==0) { /* strobe presented */ fputc (uptr->buf & 0177, uptr->fileref); /* put out char */ if (ferror (uptr->fileref)) { - perror ("LP I/O error"); + sim_perror ("LP I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/SDS/sds_lp.c b/SDS/sds_lp.c index 1462bd88..1c961875 100644 --- a/SDS/sds_lp.c +++ b/SDS/sds_lp.c @@ -245,7 +245,7 @@ if (uptr->flags & UNIT_ATT) { /* attached? */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* I/O error? */ lpt_end_op (CHF_EOR | CHF_ERR); /* set err, disc */ - perror ("LPT I/O error"); /* print msg */ + sim_perror ("LPT I/O error"); /* print msg */ clearerr (uptr->fileref); return SCPE_IOERR; /* ret error */ } diff --git a/SDS/sds_stddev.c b/SDS/sds_stddev.c index 864a8ba7..f9685de2 100644 --- a/SDS/sds_stddev.c +++ b/SDS/sds_stddev.c @@ -280,7 +280,7 @@ if ((temp = getc (ptr_unit.fileref)) == EOF) { /* end of file? */ sim_printf ("PTR end of file\n"); else return SCPE_OK; } - else perror ("PTR I/O error"); /* I/O error */ + else sim_perror ("PTR I/O error"); /* I/O error */ clearerr (ptr_unit.fileref); return SCPE_IOERR; } @@ -414,7 +414,7 @@ if ((ptp_unit.flags & UNIT_ATT) == 0) { /* attached? */ } if (putc (dat, ptp_unit.fileref) == EOF) { /* I/O error? */ ptp_set_err (); /* yes, disc, err */ - perror ("PTP I/O error"); /* print msg */ + sim_perror ("PTP I/O error"); /* print msg */ clearerr (ptp_unit.fileref); return SCPE_IOERR; } diff --git a/TX-0/tx0_stddev.c b/TX-0/tx0_stddev.c index b23cf7d9..ac0f09ac 100644 --- a/TX-0/tx0_stddev.c +++ b/TX-0/tx0_stddev.c @@ -366,7 +366,7 @@ if ((uptr->flags & UNIT_ATT) == 0) { /* attached? */ ios = 0; return SCPE_IOERR; } - else perror ("PETR I/O error"); + else sim_perror ("PETR I/O error"); clearerr (uptr->fileref); ios = 0; return SCPE_IOERR; @@ -533,7 +533,7 @@ t_stat ptp_svc (UNIT *uptr) if ((uptr->flags & UNIT_ATT) == 0) /* not attached? */ return SCPE_UNATT; if (putc (uptr->buf, uptr->fileref) == EOF) { /* I/O error? */ - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/VAX/vax730_rb.c b/VAX/vax730_rb.c index 0c5cdfc7..56866c81 100644 --- a/VAX/vax730_rb.c +++ b/VAX/vax730_rb.c @@ -592,7 +592,7 @@ rbda = rbda + ((wc + (RB_NUMWD(uptr) - 1)) / RB_NUMWD(uptr)); rb_set_done (0); if (err != 0) { /* error? */ - perror ("RB I/O error"); + sim_perror ("RB I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } diff --git a/VAX/vax_sysdev.c b/VAX/vax_sysdev.c index a179ca83..5518a7ef 100644 --- a/VAX/vax_sysdev.c +++ b/VAX/vax_sysdev.c @@ -816,7 +816,7 @@ if (cso_csr & CSR_IE) if ((cso_unit.flags & UNIT_ATT) == 0) return SCPE_OK; if (putc (cso_unit.buf, cso_unit.fileref) == EOF) { - perror ("CSO I/O error"); + sim_perror ("CSO I/O error"); clearerr (cso_unit.fileref); return SCPE_IOERR; } diff --git a/scp.c b/scp.c index 15032b42..fb5f1074 100644 --- a/scp.c +++ b/scp.c @@ -5272,7 +5272,7 @@ if (uptr->flags & UNIT_BUF) { rewind (uptr->fileref); sim_fwrite (uptr->filebuf, SZ_D (dptr), cap, uptr->fileref); if (ferror (uptr->fileref)) - perror ("I/O error"); + sim_printf ("%s: I/O error - %s", sim_dname (dptr), strerror (errno)); } if (uptr->flags & UNIT_MUSTBUF) { /* dyn alloc? */ free (uptr->filebuf); /* free buf */ @@ -9581,6 +9581,11 @@ if (buf != stackbuf) free (buf); } +void sim_perror (const char *msg) +{ +sim_printf ("%s: %s\n", msg, strerror (errno)); +} + /* Print command result message to stdout, sim_log (if enabled) and sim_deb (if enabled) */ t_stat sim_messagef (t_stat stat, const char* fmt, ...) { diff --git a/scp.h b/scp.h index cb1d96a4..cd8d0150 100644 --- a/scp.h +++ b/scp.h @@ -186,6 +186,7 @@ const char *sim_error_text (t_stat stat); t_stat sim_string_to_stat (char *cptr, t_stat *cond); t_stat sim_cancel_step (void); void sim_printf (const char* fmt, ...); +void sim_perror (const char* msg); t_stat sim_messagef (t_stat stat, const char* fmt, ...); void sim_data_trace(DEVICE *dptr, UNIT *uptr, const uint8 *data, const char *position, size_t len, const char *txt, uint32 reason); void sim_debug_bits (uint32 dbits, DEVICE* dptr, BITFIELD* bitdefs, diff --git a/sigma/sigma_dp.c b/sigma/sigma_dp.c index 322a1b42..0990ed72 100644 --- a/sigma/sigma_dp.c +++ b/sigma/sigma_dp.c @@ -1081,7 +1081,7 @@ t_stat dp_ioerr (UNIT *uptr) uint32 cidx = uptr->UCTX; uint32 dva = dp_dib[cidx].dva; -perror ("DP I/O error"); +sim_perror ("DP I/O error"); clearerr (uptr->fileref); dp_ctx[cidx].dp_flags |= DPF_DPE; /* set DPE flag */ chan_set_chf (dva, CHF_XMDE); diff --git a/sigma/sigma_lp.c b/sigma/sigma_lp.c index 48794286..e125be04 100644 --- a/sigma/sigma_lp.c +++ b/sigma/sigma_lp.c @@ -353,7 +353,7 @@ if (skp && CHP (CH_TOF, lp_cct[lp_cctp])) /* skip, TOF? */ } uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("Line printer I/O error"); + sim_perror ("Line printer I/O error"); clearerr (uptr->fileref); chan_set_chf (lp_dib.dva, CHF_XMDE); return SCPE_IOERR; @@ -388,7 +388,7 @@ if ((lp_model == LP_7440) || lp_pass) { /* ready to print? */ fputc (lp_inh? '\r': '\n', uptr->fileref); /* cr or nl */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - perror ("Line printer I/O error"); + sim_perror ("Line printer I/O error"); clearerr (uptr->fileref); chan_set_chf (lp_dib.dva, CHF_XMDE); return SCPE_IOERR; diff --git a/sigma/sigma_pt.c b/sigma/sigma_pt.c index f5507f6b..1ffe60ed 100644 --- a/sigma/sigma_pt.c +++ b/sigma/sigma_pt.c @@ -186,7 +186,7 @@ switch (pt_cmd) { /* case on state */ break; } else { /* real error */ - perror ("PTR I/O error"); + sim_perror ("PTR I/O error"); clearerr (uptr->fileref); chan_set_chf (pt_dib.dva, CHF_XMDE); /* data error */ return pt_chan_err (SCPE_IOERR); /* force uend */ @@ -212,7 +212,7 @@ switch (pt_cmd) { /* case on state */ if (CHS_IFERR (st)) /* channel error? */ return pt_chan_err (st); if (putc (c, pt_unit[PTP].fileref) == EOF) { - perror ("PTP I/O error"); + sim_perror ("PTP I/O error"); clearerr (pt_unit[PTP].fileref); chan_set_chf (pt_dib.dva, CHF_XMDE); /* data error */ return pt_chan_err (SCPE_IOERR); /* force uend */ diff --git a/sim_disk.c b/sim_disk.c index 1f0438a0..584984ea 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1355,7 +1355,7 @@ switch (DK_GET_FMT (uptr)) { /* case on format */ case DKUF_F_STD: /* SIMH format */ case DKUF_F_VHD: /* VHD format */ case DKUF_F_RAW: /* Raw Physical Disk Access */ - perror (msg); + sim_printf ("%s %s: %s\n", sim_uname(uptr), msg, strerror(errno)); default: ; } diff --git a/sim_tape.c b/sim_tape.c index 96c536f3..c7367f7c 100644 --- a/sim_tape.c +++ b/sim_tape.c @@ -2050,7 +2050,7 @@ return ((uptr->flags & MTUF_WRP) || (MT_GET_FMT (uptr) == MTUF_F_TPC))? TRUE: FA t_stat sim_tape_ioerr (UNIT *uptr) { -perror ("Magtape library I/O error"); +sim_printf ("%s: Magtape library I/O error: %s\n", sim_uname (uptr), strerror (errno)); clearerr (uptr->fileref); return MTSE_IOERR; }