Added a -N switch to the standard attach_unit routine to force a new file to be created.
This commit is contained in:
parent
958ce00b2e
commit
d1db9ce203
2 changed files with 34 additions and 24 deletions
BIN
doc/simh_doc.doc
BIN
doc/simh_doc.doc
Binary file not shown.
12
scp.c
12
scp.c
|
@ -3394,6 +3394,14 @@ if (sim_switches & SWMASK ('R')) { /* read only? */
|
|||
if (!sim_quiet)
|
||||
printf ("%s: unit is read only\n", sim_dname (dptr));
|
||||
}
|
||||
else {
|
||||
if (sim_switches & SWMASK ('N')) { /* new file only? */
|
||||
uptr->fileref = sim_fopen (cptr, "wb+"); /* open new file */
|
||||
if (uptr->fileref == NULL) /* open fail? */
|
||||
return attach_err (uptr, SCPE_OPENERR); /* yes, error */
|
||||
if (!sim_quiet)
|
||||
printf ("%s: creating new file\n", sim_dname (dptr));
|
||||
}
|
||||
else { /* normal */
|
||||
uptr->fileref = sim_fopen (cptr, "rb+"); /* open r/w */
|
||||
if (uptr->fileref == NULL) { /* open fail? */
|
||||
|
@ -3417,10 +3425,12 @@ else { /* normal */
|
|||
uptr->fileref = sim_fopen (cptr, "wb+");/* open new file */
|
||||
if (uptr->fileref == NULL) /* open fail? */
|
||||
return attach_err (uptr, SCPE_OPENERR); /* yes, error */
|
||||
if (!sim_quiet) printf ("%s: creating new file\n", sim_dname (dptr));
|
||||
if (!sim_quiet)
|
||||
printf ("%s: creating new file\n", sim_dname (dptr));
|
||||
}
|
||||
} /* end if null */
|
||||
} /* end else */
|
||||
}
|
||||
if (uptr->flags & UNIT_BUFABLE) { /* buffer? */
|
||||
uint32 cap = ((uint32) uptr->capac) / dptr->aincr; /* effective size */
|
||||
if (uptr->flags & UNIT_MUSTBUF) /* dyn alloc? */
|
||||
|
|
Loading…
Add table
Reference in a new issue