1 /* vi: set sw=4 ts=4: */
13 /* missing: eod/seod, stoptions, stwrthreshold, densities */
14 static const struct mt_opcodes opcodes[] = {
19 {"datacompression", MTCOMPRESSION},
31 {"rewoffline", MTOFFL},
36 {"retension", MTRETEN},
40 {"setdensity", MTSETDENSITY},
41 {"drvbuffer", MTSETDRVBUFFER},
42 {"setpart", MTSETPART},
52 extern int mt_main(int argc, char **argv)
54 const char *file = "/dev/tape";
55 const struct mt_opcodes *code = opcodes;
63 if (strcmp(argv[1], "-f") == 0) {
72 while (code->name != 0) {
73 if (strcmp(code->name, argv[1]) == 0)
78 if (code->name == 0) {
79 error_msg("unrecognized opcode %s.", argv[1]);
83 op.mt_op = code->value;
85 op.mt_count = atoi(argv[2]);
87 op.mt_count = 1; /* One, not zero, right? */
89 if ((fd = open(file, O_RDONLY, 0)) < 0)
90 perror_msg_and_die("%s", file);
92 if (ioctl(fd, MTIOCTOP, &op) != 0)
93 perror_msg_and_die("%s", file);