1 /* vi: set sw=4 ts=4: */
7 static const char mt_usage[] = "mt [-f device] opcode value\n";
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;
60 if (strcmp(argv[1], "-f") == 0) {
69 while (code->name != 0) {
70 if (strcmp(code->name, argv[1]) == 0)
75 if (code->name == 0) {
76 fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
80 op.mt_op = code->value;
82 op.mt_count = atoi(argv[2]);
84 op.mt_count = 1; /* One, not zero, right? */
86 if ((fd = open(file, O_RDONLY, 0)) < 0) {
91 if (ioctl(fd, MTIOCTOP, &op) != 0) {