1 /* vi: set sw=4 ts=4: */
14 /* missing: eod/seod, stoptions, stwrthreshold, densities */
15 static const struct mt_opcodes opcodes[] = {
20 {"datacompression", MTCOMPRESSION},
32 {"rewoffline", MTOFFL},
37 {"retension", MTRETEN},
41 {"setdensity", MTSETDENSITY},
42 {"drvbuffer", MTSETDRVBUFFER},
43 {"setpart", MTSETPART},
53 extern int mt_main(int argc, char **argv)
55 const char *file = "/dev/tape";
56 const struct mt_opcodes *code = opcodes;
64 if (strcmp(argv[1], "-f") == 0) {
73 while (code->name != 0) {
74 if (strcmp(code->name, argv[1]) == 0)
79 if (code->name == 0) {
80 error_msg("unrecognized opcode %s.", argv[1]);
84 op.mt_op = code->value;
86 op.mt_count = atoi(argv[2]);
88 op.mt_count = 1; /* One, not zero, right? */
90 switch (code->value) {
103 if ((fd = open(file, mode, 0)) < 0)
104 perror_msg_and_die("%s", file);
106 if (ioctl(fd, MTIOCTOP, &op) != 0)
107 perror_msg_and_die("%s", file);