]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Changed from Blocks as parameter to Bytes.
authorhades <hades>
Fri, 19 May 2000 06:18:52 +0000 (06:18 +0000)
committerhades <hades>
Fri, 19 May 2000 06:18:52 +0000 (06:18 +0000)
hadaq/hwtape.c
hadaq/hwtapelabel.c

index be1df69269f9a72d3b666a1c3ac56bab4715f2da..d75359fa6a8e1b8ae2fded0b8c1efd75c4cc6d44 100644 (file)
@@ -97,7 +97,7 @@ static FILE *openTape(const char* filename) {
        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) {
@@ -105,7 +105,7 @@ int closeTape(FILE *openTape, int tape, int numBlocks, const char *filename) {
                exit(-2);
        }
 
-       writeTrailer(tape, 0, numBlocks, filename);
+       writeTrailer(tape, 0, numBytes, filename);
 
        stat = close(tape);
        if (stat == -1) {
index 928a56528ca07a6c7fdd21da6b9f18a6b2b79d72..09b01d3bbd525f16fc572dc7f4c92b651a994325 100644 (file)
@@ -154,7 +154,7 @@ int writeHeader(int tape, int fileSeqNum, const char *filename) {
 }
 
 
-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;
@@ -189,14 +189,14 @@ int writeTrailer(int tape, int fileSeqNum, int numBlocks, const char *filename)
 
        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");