Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
add %M to query the message
Baptiste Daroussin committed 14 years ago
commit 3403a12ec45146562f02ba38795d576b40a5f3ab
parent 92d1967
2 files changed +9 -1
modified pkg/pkg-query.1
@@ -15,7 +15,7 @@
.\"     @(#)pkg.1
.\" $FreeBSD$
.\"
-
.Dd January 24, 2012
+
.Dd Februrary 11, 2012
.Dt PKG-QUERY 1
.Os
.Sh NAME
@@ -81,6 +81,8 @@ The flat size in human readable format of the matched package
The flat size in bytes of the matched package
.It Cm \&%a
Returns 1 if the matched package is an orphan package and can be pkg-autoremove(1)'d, 0 otherwise
+
.It Cm \&%M
+
message contain in the matched package
.It Cm \&%? Ns Op drCFIDLUG
Returns 0 if the list is empty and 1 if the list has information to display
.Bl -tag -width indent
modified pkg/query.c
@@ -41,6 +41,7 @@ static struct query_flags {
        { 'w', "",		0, PKG_LOAD_BASIC },
        { 'l', "",		0, PKG_LOAD_BASIC },
        { 'a', "",		0, PKG_LOAD_BASIC },
+
        { 'M', "",		0, PKG_LOAD_BASIC },
};

const unsigned int flags_len = (sizeof(q_flags)/sizeof(q_flags[0]));
@@ -198,6 +199,11 @@ format_str(struct pkg *pkg, struct sbuf *dest, const char *qstr, void *data)
				case 'G':
					sbuf_cat(dest, pkg_group_name((struct pkg_group *)data));
					break;
+
				case 'M':
+
					pkg_get(pkg, PKG_MESSAGE, &tmp);
+
					if (tmp != NULL)
+
						sbuf_cat(dest, tmp);
+
					break;
				case '%':
					sbuf_putc(dest, '%');
					break;