From 5e1189e187f6a7957dadb8eda2c271c4a0777a23 Mon Sep 17 00:00:00 2001 From: Erik Andersen Date: Sat, 15 Apr 2000 16:34:54 +0000 Subject: More documentation updates, and minor fixes to make things sync up with the docs. -Erik --- miscutils/mt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'miscutils/mt.c') diff --git a/miscutils/mt.c b/miscutils/mt.c index 9791b64b2..cf20d1711 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c @@ -4,7 +4,8 @@ #include #include -static const char mt_usage[] = "mt [-f device] opcode value\n"; +static const char mt_usage[] = "mt [-f device] opcode value\n\n" + "Control magnetic tape drive operation\n"; struct mt_opcodes { char *name; @@ -56,6 +57,10 @@ extern int mt_main(int argc, char **argv) const struct mt_opcodes *code = opcodes; struct mtop op; int fd; + + if ((argc != 2 && argc != 3) || **(argv + 1) == '-') { + usage(mt_usage); + } if (strcmp(argv[1], "-f") == 0) { if (argc < 4) { @@ -74,7 +79,7 @@ extern int mt_main(int argc, char **argv) if (code->name == 0) { fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]); - return (FALSE); + exit (FALSE); } op.mt_op = code->value; @@ -85,13 +90,13 @@ extern int mt_main(int argc, char **argv) if ((fd = open(file, O_RDONLY, 0)) < 0) { perror(file); - return (FALSE); + exit (FALSE); } if (ioctl(fd, MTIOCTOP, &op) != 0) { perror(file); - return (FALSE); + exit (FALSE); } - return (TRUE); + exit (TRUE); } -- cgit v1.2.3