/* $Id: tape_fun.c,v 1.12 2008/04/11 17:44:27 tl Exp $ */ #include #include #include #include #include #include /* #include */ /* ============================ */ int #ifdef OLDSUNOS rew_tape(fp) int fp; #else rew_tape(int fp) #endif { struct mtop mt_command; mt_command.mt_op = MTREW; ioctl(fp, MTIOCTOP, &mt_command); return (0); } /* ============================ */ int #ifdef OLDSUNOS WEOF_tape(fp) int fp; #else WEOF_tape(int fp) #endif { struct mtop mt_command; mt_command.mt_op = MTWEOF; ioctl(fp, MTIOCTOP, &mt_command); return (0); } /* ============================ */ int #ifdef OLDSUNOS fskp_tape(fp, i) int fp; int i; #else fskp_tape(int fp, int i) #endif { struct mtop mt_command; mt_command.mt_op = MTFSF; mt_command.mt_count = i; ioctl(fp, MTIOCTOP, &mt_command); return (0); } /* ============================ */ int #ifdef OLDSUNOS status_tape(fp) int fp; #else status_tape(int fp) #endif { struct mtget mt_status; /* inquire */ ioctl(fp, MTIOCGET, (char *) &mt_status); /* result */ #if(0) printf("magtape device: 0x%x, ", mt_status.mt_type); printf("drive status : %i, ", mt_status.mt_dsreg); printf("error register : %i, ", mt_status.mt_erreg); printf("residual count : %i\n", mt_status.mt_resid); #endif printf("TAPE_INFO: file number : %i, ", mt_status.mt_fileno); printf("block number : %i\n", mt_status.mt_blkno); #if(0) printf("mt_flags : %i, ", mt_status.mt_flags); printf("optimum blocking factor :%i\n", mt_status.mt_bf); #endif /* done */ return (0); }