diff options
author | pjd <pjd@FreeBSD.org> | 2004-05-24 22:52:32 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2004-05-24 22:52:32 +0000 |
commit | 322e28b5538399dca2d1063201a6d19520eeaffc (patch) | |
tree | 71dd5626c54cf5fb23c7dc2efff17affc9a2a9b8 /usr.sbin | |
parent | 72e7aa908c82a0eef8761e6345938417a59b2ebb (diff) | |
download | FreeBSD-src-322e28b5538399dca2d1063201a6d19520eeaffc.zip FreeBSD-src-322e28b5538399dca2d1063201a6d19520eeaffc.tar.gz |
In verbose mode print disk sizes in human readable form as well.
OK'ed by: phk
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/diskinfo/Makefile | 3 | ||||
-rw-r--r-- | usr.sbin/diskinfo/diskinfo.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/diskinfo/Makefile b/usr.sbin/diskinfo/Makefile index 1c56987..5ffa27f6 100644 --- a/usr.sbin/diskinfo/Makefile +++ b/usr.sbin/diskinfo/Makefile @@ -5,6 +5,9 @@ MAN= diskinfo.8 WARNS?= 5 +DPADD= ${LIBUTIL} +LDADD= -lutil + .include <bsd.prog.mk> test: ${PROG} diff --git a/usr.sbin/diskinfo/diskinfo.c b/usr.sbin/diskinfo/diskinfo.c index 986ad24..49ef474 100644 --- a/usr.sbin/diskinfo/diskinfo.c +++ b/usr.sbin/diskinfo/diskinfo.c @@ -35,6 +35,7 @@ #include <unistd.h> #include <errno.h> #include <fcntl.h> +#include <libutil.h> #include <paths.h> #include <err.h> #include <sys/disk.h> @@ -110,10 +111,13 @@ main(int argc, char **argv) printf("\t%u", fwsectors); } } else { + humanize_number(buf, 6 - (mediasize < 0 ? 0 : 1), + (int64_t)mediasize, "", + HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); printf("%s\n", argv[i]); printf("\t%-12u\t# sectorsize\n", sectorsize); - printf("\t%-12jd\t# mediasize in bytes\n", - (intmax_t)mediasize); + printf("\t%-12jd\t# mediasize in bytes (%s)\n", + (intmax_t)mediasize, buf); printf("\t%-12jd\t# mediasize in sectors\n", (intmax_t)mediasize/sectorsize); if (fwsectors != 0 && fwheads != 0) { |