diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h index c2d5eed72c01..21563ca0c0a1 100644 --- a/usr.sbin/pkg_install/info/info.h +++ b/usr.sbin/pkg_install/info/info.h @@ -62,6 +62,7 @@ TAILQ_HEAD(which_head, which_entry); extern int Flags; extern Boolean Quiet; extern Boolean QUIET; +extern Boolean UseBlkSz; extern char *InfoPrefix; extern char PlayPen[]; extern char *CheckPkg; diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c index a3ba4fc7f7c1..344c5b233b49 100644 --- a/usr.sbin/pkg_install/info/main.c +++ b/usr.sbin/pkg_install/info/main.c @@ -26,12 +26,13 @@ __FBSDID("$FreeBSD$"); #include "info.h" #include -static char Options[] = "acdDe:fgGhiIkl:LmoO:pPqQrRst:vVW:x"; +static char Options[] = "abcdDe:fgGhiIkl:LmoO:pPqQrRst:vVW:x"; int Flags = 0; match_t MatchType = MATCH_GLOB; Boolean Quiet = FALSE; Boolean QUIET = FALSE; +Boolean UseBlkSz = FALSE; char *InfoPrefix = (char *)(uintptr_t)""; char PlayPen[FILENAME_MAX]; char *CheckPkg = NULL; @@ -63,6 +64,10 @@ main(int argc, char **argv) MatchType = MATCH_ALL; break; + case 'b': + UseBlkSz = TRUE; + break; + case 'v': Verbose = TRUE; /* Reasonable definition of 'everything' */ diff --git a/usr.sbin/pkg_install/info/pkg_info.1 b/usr.sbin/pkg_install/info/pkg_info.1 index 347367fa6506..a166ba226f8f 100644 --- a/usr.sbin/pkg_install/info/pkg_info.1 +++ b/usr.sbin/pkg_install/info/pkg_info.1 @@ -25,7 +25,7 @@ .Nd a utility for displaying information on software packages .Sh SYNOPSIS .Nm -.Op Fl cdDfgGiIkLmopPqQrRsvVx +.Op Fl bcdDfgGiIkLmopPqQrRsvVx .Op Fl e Ar package .Op Fl l Ar prefix .Op Fl t Ar template @@ -60,6 +60,12 @@ an installed package, the pathname to a package distribution file or a URL to an FTP available package. .It Fl a Show all currently installed packages. +.It Fl b +Use the BLOCKSIZE environment variable for output even when the +.Fl q +or +.Fl Q +flag is present. .It Fl v Turn on verbose output. .It Fl p @@ -189,16 +195,22 @@ command line, or from already installed package information in .Pa /var/db/pkg/ Ns Aq Ar pkg-name . .Sh ENVIRONMENT -.Ev PKG_TMPDIR -points to the directory where +.Bl -tag -width PKG_TMPDIR +.It Ev BLOCKSIZE +If the environment variable +.Ev BLOCKSIZE +is set the block counts will be displayed in units of that +size block. +.Pp +.It Ev PKG_TMPDIR +Points to the directory where .Nm creates its temporary files. If this variable is not set, .Ev TMPDIR is used. If both are unset, the builtin defaults are used. -.Pp -.Ev PKG_DBDIR -specifies an alternative location for the installed package database. +.It Ev PKG_DBDIR +Specifies an alternative location for the installed package database. .Sh FILES .Bl -tag -width /var/db/pkg -compact .It Pa /var/tmp diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index e26888d1a89c..4d397d8071c0 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -269,7 +269,10 @@ show_size(const char *title, Package *plist) if (!Quiet) printf("%lu\t(%s)\n", howmany(size, blksize), descr); else - printf("%lu\n", size); + if (UseBlkSz) + printf("%lu\n", howmany(size, blksize)); + else + printf("%lu\n", size); } /* Show files that don't match the recorded checksum */