summaryrefslogtreecommitdiffstats
path: root/usr.bin/mt
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2015-03-18 20:54:54 +0000
committerken <ken@FreeBSD.org>2015-03-18 20:54:54 +0000
commitdbd87e5d3df8c59ff3ee4a4dd30cf04bfe5778eb (patch)
tree23ab52b1db8bceb924e94dd8c6ac0b728dae5651 /usr.bin/mt
parent1cc0a333e959a384a88704ae1e68dfc880df51e7 (diff)
downloadFreeBSD-src-dbd87e5d3df8c59ff3ee4a4dd30cf04bfe5778eb.zip
FreeBSD-src-dbd87e5d3df8c59ff3ee4a4dd30cf04bfe5778eb.tar.gz
Improve the mt(1) rblim display.
The granularity reported by READ BLOCK LIMITS is an exponent, not a byte value. So a granularity of 0 means 2^0, or 1 byte. A granularity of 1 means 2^1, or 2 bytes. Print out the individual block limits on separate lines to improve readability and avoid exceeding 80 columns. usr.bin/mt/mt.c: Fix and improve the 'mt rblim' output. Add a MT_PLURAL() macro so we can print "byte" or "bytes" as appropriate. Sponsored by: Spectra Logic MFC after: 4 days
Diffstat (limited to 'usr.bin/mt')
-rw-r--r--usr.bin/mt/mt.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c
index fa66148..745766c 100644
--- a/usr.bin/mt/mt.c
+++ b/usr.bin/mt/mt.c
@@ -119,6 +119,7 @@ __FBSDID("$FreeBSD$");
#ifndef MAX
#define MAX(a, b) (a > b) ? a : b
#endif
+#define MT_PLURAL(a) (a == 1) ? "" : "s"
typedef enum {
MT_CMD_NONE = MTLOAD + 1,
@@ -384,10 +385,16 @@ main(int argc, char *argv[])
if (ioctl(mtfd, MTIOCRBLIM, (caddr_t)&rblim) < 0)
err(2, "%s", tape);
- (void)printf("%s: min blocksize %u bytes, "
- "max blocksize %u bytes, granularity %u bytes\n",
+ (void)printf("%s:\n"
+ " min blocksize %u byte%s\n"
+ " max blocksize %u byte%s\n"
+ " granularity %u byte%s\n",
tape, rblim.min_block_length,
- rblim.max_block_length, rblim.granularity);
+ MT_PLURAL(rblim.min_block_length),
+ rblim.max_block_length,
+ MT_PLURAL(rblim.max_block_length),
+ (1 << rblim.granularity),
+ MT_PLURAL((1 << rblim.granularity)));
exit(0);
/* NOTREACHED */
}
OpenPOWER on IntegriCloud