1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-02-17 04:57:52 +00:00

SCP: Updated to current.

This commit is contained in:
Richard Cornwell
2019-11-20 22:39:25 -05:00
parent 39f721faf9
commit f8c6b52192
2 changed files with 29 additions and 15 deletions

View File

@@ -782,7 +782,9 @@ else {
return NULL;
}
strlcpy (fullpath, dir, tot_len);
strlcat (fullpath, "/", tot_len);
if ((dir[strlen (dir) - 1] != '/') && /* if missing a trailing directory separator? */
(dir[strlen (dir) - 1] != '\\'))
strlcat (fullpath, "/", tot_len); /* then add one */
strlcat (fullpath, filepath, tot_len);
}
while ((c = strchr (fullpath, '\\'))) /* standardize on / directory separator */

View File

@@ -816,7 +816,16 @@ switch (MT_GET_FMT (uptr)) {
break;
}
if (r != SCPE_OK) { /* error? */
r = sim_messagef (r, "Can't open %s format tape image: %s\n", _sim_tape_format_name (uptr), cptr);
switch (MT_GET_FMT (uptr)) {
case MTUF_F_ANSI:
case MTUF_F_TAR:
case MTUF_F_FIXED:
r = sim_messagef (r, "Error opening %s format internal tape image generated from: %s\n", _sim_tape_format_name (uptr), cptr);
break;
default:
r = sim_messagef (r, "Error opening %s format tape image: %s - %s\n", _sim_tape_format_name (uptr), cptr, strerror(errno));
break;
}
if (auto_format) /* format was specified at attach time? */
sim_tape_set_fmt (uptr, 0, "SIMH", NULL); /* restore default format */
uptr->recsize = 0;
@@ -4416,24 +4425,27 @@ HDR2 hdr2;
HDR3 hdr3;
HDR4 hdr4;
memset (&statb, 0, sizeof (statb));
if (stat (filename, &statb)) {
sim_printf ("Can't stat: %s\n", filename);
return -1;
}
if (S_IFDIR & statb.st_mode) {
sim_printf ("Can't put a directory on tape: %s\n", filename);
return -1;
}
if (!(S_IFREG & statb.st_mode)) {
sim_printf ("Can't put a non regular file on tape: %s\n", filename);
return -1;
}
f = fopen (filename, "rb");
if (f == NULL) {
sim_printf ("Can't open: %s - %s\n", filename, strerror(errno));
return errno;
}
memset (&statb, 0, sizeof (statb));
if (fstat (fileno (f), &statb)) {
sim_printf ("Can't stat: %s\n", filename);
fclose (f);
return -1;
}
if (S_IFDIR & statb.st_mode) {
sim_printf ("Can't put a directory on tape: %s\n", filename);
fclose (f);
return -1;
}
if (!(S_IFREG & statb.st_mode)) {
sim_printf ("Can't put a non regular file on tape: %s\n", filename);
fclose (f);
return -1;
}
tape_classify_file_contents (f, &max_record_size, &lf_line_endings, &crlf_line_endings);
ansi_make_HDR1 (&hdr1, &tape->vol1, &hdr4, filename, tape->ansi_type);
sprintf (file_sequence, "%04d", 1 + tape->file_count);