diff options
author | Matt Kraai <kraai@debian.org> | 2001-05-21 17:01:32 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-05-21 17:01:32 +0000 |
commit | 73991ff9255f8db5e1f7ff4f9b01016b00e8b9e6 (patch) | |
tree | 0bc9429a467468d7548aecc44e9c232c61866580 /miscutils/mt.c | |
parent | ada18ff0f53f1b61073a843959e97c0f4206576e (diff) | |
download | busybox-w32-73991ff9255f8db5e1f7ff4f9b01016b00e8b9e6.tar.gz busybox-w32-73991ff9255f8db5e1f7ff4f9b01016b00e8b9e6.tar.bz2 busybox-w32-73991ff9255f8db5e1f7ff4f9b01016b00e8b9e6.zip |
Fix tell support.
Diffstat (limited to 'miscutils/mt.c')
-rw-r--r-- | miscutils/mt.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/miscutils/mt.c b/miscutils/mt.c index cd926272e..da01eb23f 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c | |||
@@ -55,6 +55,7 @@ extern int mt_main(int argc, char **argv) | |||
55 | const char *file = "/dev/tape"; | 55 | const char *file = "/dev/tape"; |
56 | const struct mt_opcodes *code = opcodes; | 56 | const struct mt_opcodes *code = opcodes; |
57 | struct mtop op; | 57 | struct mtop op; |
58 | struct mtpos position; | ||
58 | int fd, mode; | 59 | int fd, mode; |
59 | 60 | ||
60 | if (argc < 2) { | 61 | if (argc < 2) { |
@@ -103,8 +104,18 @@ extern int mt_main(int argc, char **argv) | |||
103 | if ((fd = open(file, mode, 0)) < 0) | 104 | if ((fd = open(file, mode, 0)) < 0) |
104 | perror_msg_and_die("%s", file); | 105 | perror_msg_and_die("%s", file); |
105 | 106 | ||
106 | if (ioctl(fd, MTIOCTOP, &op) != 0) | 107 | switch (code->value) { |
107 | perror_msg_and_die("%s", file); | 108 | case MTTELL: |
109 | if (ioctl(fd, MTIOCPOS, &position) < 0) | ||
110 | perror_msg_and_die("%s", file); | ||
111 | printf ("At block %d.\n", (int) position.mt_blkno); | ||
112 | break; | ||
113 | |||
114 | default: | ||
115 | if (ioctl(fd, MTIOCTOP, &op) != 0) | ||
116 | perror_msg_and_die("%s", file); | ||
117 | break; | ||
118 | } | ||
108 | 119 | ||
109 | return EXIT_SUCCESS; | 120 | return EXIT_SUCCESS; |
110 | } | 121 | } |