diff options
author | erik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-04-15 16:34:54 +0000 |
---|---|---|
committer | erik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-04-15 16:34:54 +0000 |
commit | a6c674b94b4d2c6732a58760d9086657d884671b (patch) | |
tree | 140cd30d77342c730afbc1df863bec93c63978a8 /mt.c | |
parent | c8ca3c6625e1a3f234c3f0a1ab3142179a3e529f (diff) | |
download | busybox-w32-a6c674b94b4d2c6732a58760d9086657d884671b.tar.gz busybox-w32-a6c674b94b4d2c6732a58760d9086657d884671b.tar.bz2 busybox-w32-a6c674b94b4d2c6732a58760d9086657d884671b.zip |
More documentation updates, and minor fixes to make things sync
up with the docs.
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@457 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'mt.c')
-rw-r--r-- | mt.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -4,7 +4,8 @@ | |||
4 | #include <sys/mtio.h> | 4 | #include <sys/mtio.h> |
5 | #include <sys/fcntl.h> | 5 | #include <sys/fcntl.h> |
6 | 6 | ||
7 | static const char mt_usage[] = "mt [-f device] opcode value\n"; | 7 | static const char mt_usage[] = "mt [-f device] opcode value\n\n" |
8 | "Control magnetic tape drive operation\n"; | ||
8 | 9 | ||
9 | struct mt_opcodes { | 10 | struct mt_opcodes { |
10 | char *name; | 11 | char *name; |
@@ -56,6 +57,10 @@ extern int mt_main(int argc, char **argv) | |||
56 | const struct mt_opcodes *code = opcodes; | 57 | const struct mt_opcodes *code = opcodes; |
57 | struct mtop op; | 58 | struct mtop op; |
58 | int fd; | 59 | int fd; |
60 | |||
61 | if ((argc != 2 && argc != 3) || **(argv + 1) == '-') { | ||
62 | usage(mt_usage); | ||
63 | } | ||
59 | 64 | ||
60 | if (strcmp(argv[1], "-f") == 0) { | 65 | if (strcmp(argv[1], "-f") == 0) { |
61 | if (argc < 4) { | 66 | if (argc < 4) { |
@@ -74,7 +79,7 @@ extern int mt_main(int argc, char **argv) | |||
74 | 79 | ||
75 | if (code->name == 0) { | 80 | if (code->name == 0) { |
76 | fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]); | 81 | fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]); |
77 | return (FALSE); | 82 | exit (FALSE); |
78 | } | 83 | } |
79 | 84 | ||
80 | op.mt_op = code->value; | 85 | op.mt_op = code->value; |
@@ -85,13 +90,13 @@ extern int mt_main(int argc, char **argv) | |||
85 | 90 | ||
86 | if ((fd = open(file, O_RDONLY, 0)) < 0) { | 91 | if ((fd = open(file, O_RDONLY, 0)) < 0) { |
87 | perror(file); | 92 | perror(file); |
88 | return (FALSE); | 93 | exit (FALSE); |
89 | } | 94 | } |
90 | 95 | ||
91 | if (ioctl(fd, MTIOCTOP, &op) != 0) { | 96 | if (ioctl(fd, MTIOCTOP, &op) != 0) { |
92 | perror(file); | 97 | perror(file); |
93 | return (FALSE); | 98 | exit (FALSE); |
94 | } | 99 | } |
95 | 100 | ||
96 | return (TRUE); | 101 | exit (TRUE); |
97 | } | 102 | } |