RAWTAP: Fix initial tapemark problem.

If the first record in a container file was a tape mark, the tape was, incorrectly, assumed to be empty.
This commit is contained in:
John Forecast
2017-12-14 17:06:51 -08:00
committed by Mark Pizzolato
parent 928d137f17
commit 18202f1b8d

View File

@@ -114,7 +114,7 @@ int main(
) )
{ {
int readError = 0, writeError = 0; int readError = 0, writeError = 0;
char *s, filename[16]; char *s, filename[16], bot;
FILE *file; FILE *file;
unsigned int status; unsigned int status;
@@ -233,6 +233,8 @@ int main(
usage(); usage();
while (argc >= 1) { while (argc >= 1) {
bot = 1;
switch (OpenTapeForRead(argv[0])) { switch (OpenTapeForRead(argv[0])) {
case TIO_SUCCESS: case TIO_SUCCESS:
case TIO_ERROR: case TIO_ERROR:
@@ -245,8 +247,11 @@ int main(
break; break;
case ST_TM: case ST_TM:
/* Second tape mark in a row - treat as end of medium */ /* Ignore tape mark at the beginning pf a container */
status = ST_EOM; if (!bot) {
/* Second tape mark in a row - treat as end of medium */
status = ST_EOM;
}
break; break;
default: default:
@@ -268,6 +273,7 @@ int main(
} }
break; break;
} }
bot = 0;
} while (status != ST_EOM); } while (status != ST_EOM);
CloseTape(); CloseTape();
break; break;