/****************************************************************
* program domt.c *
* *
* modified by reason *
* -------- -- ------ *
* 24-Jun-92 cbl orignal, do mt functions. *
* *
****************************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <sys/mtio.h>
#include <errno.h>
#include <string.h>
int
domt(int fd,char iop,int num)
{
int istat; /* status of operation. */
static struct mtget mt_info; /* structure of magtape info. */
static struct mtop mt_do; /* structure to preform operation */
int iret;
if (iop == 0) { /* get info. */
istat=ioctl(fd,MTIOCGET,&mt_info);
printf(" status of ioctl %x \n",istat);
printf("\n device info follows. (Dump in HEX!) \n");
printf(" device type %x \n",mt_info.mt_type);
printf(" position %x \n",mt_info.mt_dposn);
printf(" status %x \n",mt_info.mt_dsreg);
printf(" errors %x \n",mt_info.mt_erreg);
printf(" resid ??? %x \n",mt_info.mt_resid);
printf(" file number %x \n",mt_info.mt_fileno);
printf(" block number %x \n",mt_info.mt_blkno);
iret=mt_info.mt_dsreg;
} else if (iop < 22) {
mt_do.mt_op=iop;
mt_do.mt_count=num;
istat=ioctl(fd,MTIOCTOP,&mt_do);
iret=istat;
} else {
printf(" Operation not permitted \n");
}
if(istat != 0) {
perror(" ioctl operation ");
}
return(iret);
}