setvbuf(outFile, 0, _IOFBF, BLOCKSIZE);
}
-int closeTape(FILE *openTape, int tape, int numBlocks, const char *filename) {
+int closeTape(FILE *openTape, int tape, int numBytes, const char *filename) {
int stat;
stat = fclose(openTape);
if (stat == -1) {
exit(-2);
}
- writeTrailer(tape, 0, numBlocks, filename);
+ writeTrailer(tape, 0, numBytes, filename);
stat = close(tape);
if (stat == -1) {
}
-int writeTrailer(int tape, int fileSeqNum, int numBlocks, const char *filename) {
+int writeTrailer(int tape, int fileSeqNum, int numBytes, const char *filename) {
int stat;
int i;
int blockSize = BLOCKSIZE;
label = allocMem(80*sizeof(char));
- sprintf(label, "EOF1 %s0000010001%04d000100%s%02d%03d 99366 %06d%s ", ansichar(filename, 17), fileSeqNum, creaCent, (cd->tm_year)%100, cd->tm_yday, numBlocks, impId);
+ sprintf(label, "EOF1 %s0000010001%04d000100%s%02d%03d 99366 %06d%s ", ansichar(filename, 17), fileSeqNum, creaCent, (cd->tm_year)%100, cd->tm_yday, (numBytes + BLOCKSIZE - 1)/BLOCKSIZE, impId);
stat = write(tape, label, 80);
if(stat == -1) {
msglog(LOG_ERR, "Could not write ANSI label on tape!\n");
exit(-3);
}
- sprintf(label, "EOF2F%05d%05d010664 bin %010d33000 ", blockSize, blockSize, numBlocks*blockSize);
+ sprintf(label, "EOF2F%05d%05d010664 bin %010d33000 ", blockSize, blockSize, numBytes);
stat = write(tape, label, 80);
if(stat == -1) {
msglog(LOG_ERR, "Could not write ANSI label on tape!\n");