summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-03-25 00:51:41 +0000
committermdodd <mdodd@FreeBSD.org>2003-03-25 00:51:41 +0000
commit8c0555725714815a1709f7c116a52e08092ed4f9 (patch)
tree5343c59b44205140936869904a792e6618e240e7 /usr.sbin/pkg_install
parentba4c60f27ee16075b83e7a0b8fb7a465ee1409d3 (diff)
downloadFreeBSD-src-8c0555725714815a1709f7c116a52e08092ed4f9.zip
FreeBSD-src-8c0555725714815a1709f7c116a52e08092ed4f9.tar.gz
Implement the 'Q' option which is like 'q' (quiet output) except
that it prefaces the output with the package name. This is useful for things like this: # pkg_info -Qsa | awk -F : '{print $2 "\t" $1}' | sort -rn | expand -t 10
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/info/info.h1
-rw-r--r--usr.sbin/pkg_install/info/main.c8
-rw-r--r--usr.sbin/pkg_install/info/perform.c2
-rw-r--r--usr.sbin/pkg_install/info/pkg_info.18
4 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h
index 94a8b5b..c2d5eed 100644
--- a/usr.sbin/pkg_install/info/info.h
+++ b/usr.sbin/pkg_install/info/info.h
@@ -61,6 +61,7 @@ TAILQ_HEAD(which_head, which_entry);
extern int Flags;
extern Boolean Quiet;
+extern Boolean QUIET;
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 401cf13..a3ba4fc 100644
--- a/usr.sbin/pkg_install/info/main.c
+++ b/usr.sbin/pkg_install/info/main.c
@@ -26,11 +26,12 @@ __FBSDID("$FreeBSD$");
#include "info.h"
#include <err.h>
-static char Options[] = "acdDe:fgGhiIkl:LmoO:pPqrRst:vVW:x";
+static char Options[] = "acdDe:fgGhiIkl:LmoO:pPqQrRst:vVW:x";
int Flags = 0;
match_t MatchType = MATCH_GLOB;
Boolean Quiet = FALSE;
+Boolean QUIET = FALSE;
char *InfoPrefix = (char *)(uintptr_t)"";
char PlayPen[FILENAME_MAX];
char *CheckPkg = NULL;
@@ -151,6 +152,11 @@ main(int argc, char **argv)
Quiet = TRUE;
break;
+ case 'Q':
+ Quiet = TRUE;
+ QUIET = TRUE;
+ break;
+
case 't':
strlcpy(PlayPen, optarg, sizeof(PlayPen));
break;
diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c
index d87dd13..f45f7c7 100644
--- a/usr.sbin/pkg_install/info/perform.c
+++ b/usr.sbin/pkg_install/info/perform.c
@@ -191,6 +191,8 @@ pkg_do(char *pkg)
/* Start showing the package contents */
if (!Quiet)
printf("%sInformation for %s:\n\n", InfoPrefix, pkg);
+ else if (QUIET)
+ printf("%s%s:", InfoPrefix, pkg);
if (Flags & SHOW_COMMENT)
show_file("Comment:\n", COMMENT_FNAME);
if (Flags & SHOW_REQUIRE)
diff --git a/usr.sbin/pkg_install/info/pkg_info.1 b/usr.sbin/pkg_install/info/pkg_info.1
index f618e01..347367f 100644
--- a/usr.sbin/pkg_install/info/pkg_info.1
+++ b/usr.sbin/pkg_install/info/pkg_info.1
@@ -25,16 +25,18 @@
.Nd a utility for displaying information on software packages
.Sh SYNOPSIS
.Nm
-.Op Fl cdDfgGiIkLmopPqrRsvVx
+.Op Fl cdDfgGiIkLmopPqQrRsvVx
.Op Fl e Ar package
.Op Fl l Ar prefix
.Op Fl t Ar template
.Op Ar pkg-name ...
.Nm
.Op Fl q
+.Op Fl Q
.Fl W Ar filename
.Nm
.Op Fl q
+.Op Fl Q
.Fl O Ar origin
.Nm
.Fl a
@@ -67,6 +69,10 @@ Be
.Dq quiet
in emitting report headers and such, just dump the
raw info (basically, assume a non-human reading).
+.It Fl Q
+Be
+.Dq quiet
+as above but print preface output with the package name.
.It Fl c
Show the (one line) comment field for each package.
.It Fl d
OpenPOWER on IntegriCloud