1
0
mirror of https://github.com/simh/simh.git synced 2026-03-02 09:47:40 +00:00

SCP: Use relative filename paths in messages and SAVEd state

This commit is contained in:
Mark Pizzolato
2022-06-11 17:33:10 -07:00
parent 33ef5b9ef2
commit 25207bf3af

20
scp.c
View File

@@ -4067,7 +4067,7 @@ static char *do_position(void)
{
static char cbuf[4*CBUFSIZE];
snprintf (cbuf, sizeof (cbuf), "%s%s%s-%d", sim_do_filename[sim_do_depth], sim_do_label[sim_do_depth] ? "::" : "", sim_do_label[sim_do_depth] ? sim_do_label[sim_do_depth] : "", sim_goto_line[sim_do_depth]);
snprintf (cbuf, sizeof (cbuf), "%s%s%s-%d", sim_relative_path (sim_do_filename[sim_do_depth]), sim_do_label[sim_do_depth] ? "::" : "", sim_do_label[sim_do_depth] ? sim_do_label[sim_do_depth] : "", sim_goto_line[sim_do_depth]);
return cbuf;
}
@@ -6209,7 +6209,7 @@ if (0 == sim_fseek (uptr->fileref, 0, SEEK_END)) {
return SCPE_OK;
}
return sim_messagef (SCPE_IERR, "%s Can't seek to end of file: %s - %s\n", sim_uname (uptr), uptr->filename, strerror (errno));
return sim_messagef (SCPE_IERR, "%s Can't seek to end of file: %s - %s\n", sim_uname (uptr), sim_relative_path (uptr->filename), strerror (errno));
}
/* Show command */
@@ -6508,7 +6508,7 @@ if (uptr->flags & UNIT_FIX) {
}
if (uptr->flags & UNIT_ATT) {
fprint_sep (st, &toks);
fprintf (st, "attached to %s", uptr->filename);
fprintf (st, "attached to %s", sim_relative_path (uptr->filename));
if (uptr->flags & UNIT_RO)
fprintf (st, ", read only");
}
@@ -8429,7 +8429,7 @@ if ((uptr->flags & UNIT_BUF) && (uptr->filebuf)) {
uint32 cap = (uptr->hwmark + dptr->aincr - 1) / dptr->aincr;
if (((uptr->flags & UNIT_RO) == 0) &&
(memcmp (uptr->filebuf, uptr->filebuf2, (size_t)(SZ_D (dptr) * (uptr->capac / dptr->aincr))) != 0)) {
sim_messagef (SCPE_OK, "%s: writing buffer to file: %s\n", sim_uname (uptr), uptr->filename);
sim_messagef (SCPE_OK, "%s: writing buffer to file: %s\n", sim_uname (uptr), sim_relative_path (uptr->filename));
rewind (uptr->fileref);
sim_fwrite (uptr->filebuf, SZ_D (dptr), cap, uptr->fileref);
if (ferror (uptr->fileref))
@@ -8654,7 +8654,7 @@ for (i = 0; i < (device_count + sim_internal_device_count); i++) {/* loop thru d
fprintf (sfile, "%.0f\n", uptr->usecs_remaining);/* [V4.0] remaining wait */
WRITE_I (uptr->pos);
if (uptr->flags & UNIT_ATT) {
fputs (uptr->filename, sfile);
fputs (sim_relative_path (uptr->filename), sfile);
if ((uptr->flags & UNIT_BUF) && /* writable buffered */
uptr->hwmark && /* files need to be */
((uptr->flags & UNIT_RO) == 0)) { /* written on save */
@@ -8857,7 +8857,7 @@ else {
for (j = 0; j < dptr->numunits; j++) { /* loop thru units */
uptr = (dptr->units) + j;
if (uptr->flags & UNIT_ATT) { /* attached? */
sim_printf ("warning - leaving %s attached to '%s'\n", sim_uname (uptr), uptr->filename);
sim_printf ("warning - leaving %s attached to '%s'\n", sim_uname (uptr), sim_relative_path (uptr->filename));
warned = TRUE;
}
}
@@ -8936,7 +8936,7 @@ for ( ;; ) { /* device loop */
(!dont_detach_attach)) {
r = scp_detach_unit (dptr, uptr); /* detach it */
if (r != SCPE_OK) {
sim_printf ("Error detaching %s from %s: %s\n", sim_uname (uptr), uptr->filename, sim_error_text (r));
sim_printf ("Error detaching %s from %s: %s\n", sim_uname (uptr), sim_relative_path (uptr->filename), sim_error_text (r));
r = SCPE_INCOMP;
goto Cleanup_Return;
}
@@ -9077,7 +9077,7 @@ for (j=0, r = SCPE_OK; j<attcnt; j++) {
warned = TRUE;
sim_printf ("warning - %s was attached to '%s'", sim_uname (attunits[j]), attnames[j]);
if (attunits[j]->filename)
sim_printf (", now attached to '%s'\n", attunits[j]->filename);
sim_printf (", now attached to '%s'\n", sim_relative_path (attunits[j]->filename));
else
sim_printf (", now unattached\n");
}
@@ -9309,7 +9309,7 @@ for (i = 1; (dptr = sim_devices[i]) != NULL; i++) { /* reposition all */
if ((uptr->flags & (UNIT_ATT + UNIT_SEQ)) == (UNIT_ATT + UNIT_SEQ))
if (sim_can_seek (uptr->fileref) &&
(0 != sim_fseek (uptr->fileref, uptr->pos, SEEK_SET)))
return sim_messagef (SCPE_IERR, "Can't seek to %u in %s for %s\n", (unsigned)uptr->pos, uptr->filename, sim_uname (uptr));
return sim_messagef (SCPE_IERR, "Can't seek to %u in %s for %s\n", (unsigned)uptr->pos, sim_relative_path (uptr->filename), sim_uname (uptr));
}
}
if ((r = sim_ttrun ()) != SCPE_OK) { /* set console mode */
@@ -10212,7 +10212,7 @@ if (uptr->flags & UNIT_RO) /* read only? */
return sim_messagef (SCPE_RO, "%s is read only.\n"
"%sse a writable device to change %s\n",
sim_uname (uptr), (uptr->flags & UNIT_ROABLE) ? "Attach Read/Write or u" : "U",
uptr->filename ? uptr->filename : "it");
uptr->filename ? sim_relative_path (uptr->filename) : "it");
mask = width_mask[dptr->dwidth];
GET_RADIX (rdx, dptr->dradix);