diff options
| author | Philippe Charnier <charnier@FreeBSD.org> | 1997-07-30 06:48:15 +0000 |
|---|---|---|
| committer | Philippe Charnier <charnier@FreeBSD.org> | 1997-07-30 06:48:15 +0000 |
| commit | 1d6b7f4f37ce636a46d8fb0ddb28e412b6640774 (patch) | |
| tree | 0689ff1ede22703fec3fd8154c025bc905e9afb9 /usr.bin/mt | |
| parent | 0021dea42ba568280c8d4161cf72e5ebde6749ed (diff) | |
Notes
Diffstat (limited to 'usr.bin/mt')
| -rw-r--r-- | usr.bin/mt/mt.1 | 8 | ||||
| -rw-r--r-- | usr.bin/mt/mt.c | 56 |
2 files changed, 19 insertions, 45 deletions
diff --git a/usr.bin/mt/mt.1 b/usr.bin/mt/mt.1 index 54df0977c035..8210d54433a8 100644 --- a/usr.bin/mt/mt.1 +++ b/usr.bin/mt/mt.1 @@ -39,7 +39,7 @@ .Nm mt .Nd magnetic tape manipulating program .Sh SYNOPSIS -.Nm mt +.Nm .Op Fl f Ar tapename .Ar command .Op Ar count @@ -47,7 +47,7 @@ .Nm Mt is used to give commands to a magnetic tape drive. By default -.Nm mt +.Nm performs the requested operation once. Operations may be performed multiple times by specifying .Ar count . @@ -118,7 +118,7 @@ Set compression mode. If a tape name is not specified, and the environment variable .Ev TAPE does not exist; -.Nm mt +.Nm uses the device .Pa /dev/nrst0 . .Pp @@ -210,7 +210,7 @@ SCSI magnetic tape interface .Xr environ 7 .Sh HISTORY The -.Nm mt +.Nm command appeared in .Bx 4.3 . diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c index 0eb9a1f84cb5..f6f9ca869de0 100644 --- a/usr.bin/mt/mt.c +++ b/usr.bin/mt/mt.c @@ -32,13 +32,17 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1980, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)mt.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* @@ -48,11 +52,11 @@ static char sccsid[] = "@(#)mt.c 8.1 (Berkeley) 6/6/93"; #include <sys/types.h> #include <sys/ioctl.h> #include <sys/mtio.h> +#include <ctype.h> +#include <err.h> #include <fcntl.h> -#include <errno.h> -#include <stdlib.h> #include <stdio.h> -#include <ctype.h> +#include <stdlib.h> #include <string.h> /* the appropriate sections of <sys/mtio.h> are also #ifdef'd for FreeBSD */ @@ -99,7 +103,6 @@ struct commands { { NULL } }; -void err __P((const char *, ...)); void printreg __P((char *, u_int, char *)); void status __P((struct mtget *)); void usage __P((void)); @@ -143,7 +146,7 @@ main(argc, argv) len = strlen(p = *argv++); for (comp = com;; comp++) { if (comp->c_name == NULL) - err("%s: unknown command", p); + errx(1, "%s: unknown command", p); if (strncmp(p, comp->c_name, len) == 0) break; } @@ -155,7 +158,7 @@ main(argc, argv) } #endif /* defined(__FreeBSD__) */ if ((mtfd = open(tape, comp->c_ronly ? O_RDONLY : O_RDWR)) < 0) - err("%s: %s", tape, strerror(errno)); + err(1, "%s", tape); if (comp->c_code != MTNOP) { mt_com.mt_op = comp->c_code; if (*argv) { @@ -165,7 +168,7 @@ main(argc, argv) const char *dcanon; mt_com.mt_count = stringtodens(*argv); if (mt_com.mt_count == 0) - err("%s: unknown density", *argv); + errx(1, "%s: unknown density", *argv); dcanon = denstostring(mt_com.mt_count); if (strcmp(dcanon, *argv) != 0) printf( @@ -185,15 +188,15 @@ main(argc, argv) 0 #endif /* defined (__FreeBSD__) */ || *p) - err("%s: illegal count", *argv); + errx(1, "%s: illegal count", *argv); } else mt_com.mt_count = 1; if (ioctl(mtfd, MTIOCTOP, &mt_com) < 0) - err("%s: %s: %s", tape, comp->c_name, strerror(errno)); + err(1, "%s: %s", tape, comp->c_name); } else { if (ioctl(mtfd, MTIOCGET, &mt_status) < 0) - err("%s", strerror(errno)); + err(1, NULL); status(&mt_status); } exit (0); @@ -312,7 +315,7 @@ printreg(s, v, bits) bits++; if (v && bits) { putchar('<'); - while (i = *bits++) { + while ((i = *bits++)) { if (v & (1 << (i-1))) { if (any) putchar(','); @@ -334,35 +337,6 @@ usage() exit(1); } -#if __STDC__ -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -void -#if __STDC__ -err(const char *fmt, ...) -#else -err(fmt, va_alist) - char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - (void)fprintf(stderr, "mt: "); - (void)vfprintf(stderr, fmt, ap); - va_end(ap); - (void)fprintf(stderr, "\n"); - exit(1); - /* NOTREACHED */ -} - #if defined (__FreeBSD__) struct densities { |
