/dev/st0?

Robert Ambrose rna@testpt.com
Thu, 31 Aug 2000 21:27:18 -0700 (MST)


Here a ye olde quick and dirty options script/program.  Think of it as a
starting point.  What st.c really needs is a /proc file to get the options
from (hmmm, I feel a plan comming 8-) ).

The 'C' part:

#include <stdio.h>
#include <fcntl.h>
#include <error.h>
#include <sys/mtio.h>

int
main (
	int argc,
	char **argv
)
{
	int fd;
	struct mtop mtop;

	if((fd = open(argv[1], O_RDONLY|O_NONBLOCK)) == -1)
		perror("Can't open tape drive");
	mtop.mt_op = MTSETDRVBUFFER;
	mtop.mt_count = MT_ST_CLEARBOOLEANS | MT_ST_DEBUGGING;
	if(ioctl(fd, MTIOCTOP, &mtop) == -1)
		perror("ioctl failed");
	close(fd);
	exit(0);
}

And the script part:

mtdumpoptions /dev/st0

tail -4 /var/log/messages | cut -f7- -d' '