Skip to content

Commit c055b26

Browse files
committed
Fix missing file page on DUMPER tapes.
1 parent 0eaddde commit c055b26

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

dumper.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -555,21 +555,27 @@ write_record (FILE *f, int type, word_t flags)
555555
memset (block, 0, sizeof block);
556556
}
557557

558-
static void
558+
static int
559559
get_page (FILE *f)
560560
{
561561
word_t word;
562+
int ok = 0;
562563
int i;
563564

564565
memset (block + 6, 0, 512 * sizeof (word_t));
565566

567+
/* If the first word indicates EOF, return "no page".
568+
In other cases, return a partial or full page. */
566569
for (i = 0; i < 512; i++)
567570
{
568571
word = get_word (f);
569572
if (word == -1)
570-
break;
573+
return ok;
571574
block[6 + i] = word;
575+
ok = 1;
572576
}
577+
578+
return 1;
573579
}
574580

575581
static void
@@ -626,11 +632,8 @@ write_file (FILE *f, char *name)
626632
page_number = 0;
627633
write_record (f, FLHD, 0);
628634

629-
while (!feof (input))
635+
while (get_page (input))
630636
{
631-
get_page (input);
632-
if (feof (input))
633-
break;
634637
write_record (f, DATA, 0);
635638
page_number++;
636639
}

0 commit comments

Comments
 (0)