aboutsummaryrefslogtreecommitdiff
path: root/mt.c
diff options
context:
space:
mode:
authorkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-21 17:01:32 +0000
committerkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-21 17:01:32 +0000
commit088ab795ce998cd81713ac0161c1f6bc8de21c91 (patch)
tree0bc9429a467468d7548aecc44e9c232c61866580 /mt.c
parenta8070a35b9aeb810f454f1e33ba0a9e78acb5bfb (diff)
downloadbusybox-w32-088ab795ce998cd81713ac0161c1f6bc8de21c91.tar.gz
busybox-w32-088ab795ce998cd81713ac0161c1f6bc8de21c91.tar.bz2
busybox-w32-088ab795ce998cd81713ac0161c1f6bc8de21c91.zip
Fix tell support.
git-svn-id: svn://busybox.net/trunk/busybox@2685 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'mt.c')
-rw-r--r--mt.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/mt.c b/mt.c
index cd926272e..da01eb23f 100644
--- a/mt.c
+++ b/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}