From 8c0555725714815a1709f7c116a52e08092ed4f9 Mon Sep 17 00:00:00 2001 From: mdodd Date: Tue, 25 Mar 2003 00:51:41 +0000 Subject: 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 --- usr.sbin/pkg_install/info/info.h | 1 + usr.sbin/pkg_install/info/main.c | 8 +++++++- usr.sbin/pkg_install/info/perform.c | 2 ++ usr.sbin/pkg_install/info/pkg_info.1 | 8 +++++++- 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 -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 -- cgit v1.1