1 /* vi: set sw=4 ts=4: */
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
9 /* missing: eod/seod, stoptions, stwrthreshold, densities */
10 static const short opcode_value[] = {
47 static const char opcode_name[] ALIGN1 =
52 "datacompression" "\0"
83 int mt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
84 int mt_main(int argc UNUSED_PARAM, char **argv)
86 const char *file = "/dev/tape";
88 struct mtpos position;
95 if (strcmp(argv[1], "-f") == 0) {
96 if (!argv[2] || !argv[3])
102 idx = index_in_strings(opcode_name, argv[1]);
105 bb_error_msg_and_die("unrecognized opcode %s", argv[1]);
107 op.mt_op = opcode_value[idx];
109 op.mt_count = xatoi_u(argv[2]);
111 op.mt_count = 1; /* One, not zero, right? */
113 switch (opcode_value[idx]) {
126 fd = xopen(file, mode);
128 switch (opcode_value[idx]) {
130 ioctl_or_perror_and_die(fd, MTIOCPOS, &position, "%s", file);
131 printf("At block %d\n", (int) position.mt_blkno);
135 ioctl_or_perror_and_die(fd, MTIOCTOP, &op, "%s", file);