summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install/version
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2004-10-18 05:34:54 +0000
committerobrien <obrien@FreeBSD.org>2004-10-18 05:34:54 +0000
commita4ca4e84c424f3799326946f6280365009b0dfdd (patch)
treedf2afb569e1312976b45e1b0b802534843dd7857 /usr.sbin/pkg_install/version
parentbe9dd834586bafab7886afb05d8a7acc85e29806 (diff)
downloadFreeBSD-src-a4ca4e84c424f3799326946f6280365009b0dfdd.zip
FreeBSD-src-a4ca4e84c424f3799326946f6280365009b0dfdd.tar.gz
Add a -q flag to pkg_version. It suppresses the output of <,=,>.
This makes it possible to "portupgrade `pkg_version -q -l '<'`".
Diffstat (limited to 'usr.sbin/pkg_install/version')
-rw-r--r--usr.sbin/pkg_install/version/main.c6
-rw-r--r--usr.sbin/pkg_install/version/perform.c6
-rw-r--r--usr.sbin/pkg_install/version/pkg_version.115
3 files changed, 21 insertions, 6 deletions
diff --git a/usr.sbin/pkg_install/version/main.c b/usr.sbin/pkg_install/version/main.c
index 39ea37f..38ff320 100644
--- a/usr.sbin/pkg_install/version/main.c
+++ b/usr.sbin/pkg_install/version/main.c
@@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
#include "version.h"
#include <err.h>
-static char Options[] = "dhl:L:s:XtTv";
+static char Options[] = "dhl:L:qs:XtTv";
char *LimitChars = NULL;
char *PreventChars = NULL;
@@ -62,6 +62,10 @@ main(int argc, char **argv)
PreventChars = optarg;
break;
+ case 'q':
+ Quiet = TRUE;
+ break;
+
case 's':
MatchName = optarg;
break;
diff --git a/usr.sbin/pkg_install/version/perform.c b/usr.sbin/pkg_install/version/perform.c
index c1e952d..d5b817d 100644
--- a/usr.sbin/pkg_install/version/perform.c
+++ b/usr.sbin/pkg_install/version/perform.c
@@ -290,17 +290,17 @@ show_version(const char *installed, const char *latest, const char *source)
ver = strrchr(latest, '-');
ver = ver ? &ver[1] : latest;
if (cmp < 0 && OUTPUT('<')) {
- printf("%-34s <", tmp);
+ printf("%-34s %c", tmp, Quiet ? '\0' : '<');
if (Verbose)
printf(" needs updating (%s has %s)", source, ver);
printf("\n");
} else if (cmp == 0 && OUTPUT('=')) {
- printf("%-34s =", tmp);
+ printf("%-34s %c", tmp, Quiet ? '\0' : '=');
if (Verbose)
printf(" up-to-date with %s", source);
printf("\n");
} else if (cmp > 0 && OUTPUT('>')) {
- printf("%-34s >", tmp);
+ printf("%-34s %c", tmp, Quiet ? '\0' : '>');
if (Verbose)
printf(" succeeds %s (%s has %s)", source, source, ver);
printf("\n");
diff --git a/usr.sbin/pkg_install/version/pkg_version.1 b/usr.sbin/pkg_install/version/pkg_version.1
index 6ef25ae..ad71e6c 100644
--- a/usr.sbin/pkg_install/version/pkg_version.1
+++ b/usr.sbin/pkg_install/version/pkg_version.1
@@ -32,7 +32,7 @@
.Nd summarize installed versions of packages
.Sh SYNOPSIS
.Nm
-.Op Fl hv
+.Op Fl hqv
.Op Fl l Ar limchar
.Op Fl L Ar limchar
.Oo
@@ -137,6 +137,16 @@ Note that because some of the status flag characters are also special
to the shell, it is best to quote
.Ar limchar
with single quotes.
+.It Fl q
+Enable quiet output.
+Quiet output precludes printing the the
+.Ar limchar
+when used with
+.Fl l
+or
+.Fl L .
+This is useful when used as the input to
+.Xr portupdate 8 .
.It Fl s
Limit the output to those packages whose names match a given
.Ar string .
@@ -194,7 +204,8 @@ option has been deprecated and is no longer supported.
.Xr pkg_add 1 ,
.Xr pkg_create 1 ,
.Xr pkg_delete 1 ,
-.Xr pkg_info 1
+.Xr pkg_info 1 ,
+.Xr portupdate 8
.Sh FILES
.Bl -tag -width /usr/ports/INDEX-5 -compact
.It Pa /usr/ports/INDEX-5
OpenPOWER on IntegriCloud