# /* testmark -- test status of tape drive to see if it has just encountered * a tape mark or beginning of tape. * * Written 9/27/82 by Margaret Breslin * 4.2 Fix 8/31/84 by Cliff Shaffer */ #define EOFHT (unsigned) 04 #define EOFTM (unsigned) 040000 #define EOFTS (unsigned) 0100000 #define BOTHT (unsigned) 020002 #define BOTTM (unsigned) 042 #define BOTTS (unsigned) 0202 #define TESTEOF 1 #define TESTBOT 2 #include #include #include testmark(file,test) int file, test; { unsigned htnum,tmnum,tsnum; struct mtget tape; switch(test) { case TESTEOF: htnum = EOFHT; tmnum = EOFTM; tsnum = EOFTS; break; case TESTBOT: htnum = BOTHT; tmnum = BOTTM; tsnum = BOTTS; break; } if (ioctl(file, MTIOCGET, &tape) < 0) errprnt("error on mag tape get status command"); switch(tape.mt_type) { case MT_ISTM: if (tape.mt_erreg & tmnum) return(1); break; case MT_ISHT: if (tape.mt_dsreg & htnum) return(1); break; case MT_ISTS: if (tape.mt_erreg & tsnum) return(1); /* NOTE -- program not tested using this device */ break; default: errprnt("device type not implemented"); } return(0); }