Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add %e -- package description
Matthew Seaman committed 12 years ago
commit 8c2ef59c4cb4bbfff058c2e23d744ce19e693e50
parent cce89c5
3 files changed +26 -5
modified libpkg/pkg_printf.3
@@ -599,6 +599,9 @@ Dependency origin [string]
.It Cm %dv
Dependency version [string]
.Vt struct pkg_dep *
+
.It Cm %e
+
Description [string]
+
.Vt struct pkg *
.It Cm %i
Additional information [string]
.Vt struct pkg *
modified libpkg/pkg_printf.c
@@ -121,7 +121,8 @@
 * do pkg_dep      dependency origin
 * dv pkg_dep      dependency version
 *
-
 * e
+
 * e  pkg          Package description
+
 *
 * f
 * g
 * h
@@ -256,6 +257,8 @@ static const struct pkg_printf_fmt fmt[] = {
	{ 'd', 'v',   false, PP_PKG|PP_d,	&format_dependency_version, },
	[PP_PKG_DEPENDENCIES] =
	{ 'd', '\0',  true,  PP_PKG,		&format_dependencies, },
+
	[PP_PKG_DESCRIPTION] =
+
	{ 'e', '\0',  false, PP_ALL,		&format_description, },
	[PP_PKG_ADDITIONAL_INFO] =
	{ 'i', '\0',  false, PP_ALL,		&format_add_info, },
	[PP_PKG_LOCK_STATUS] =
@@ -1015,6 +1018,19 @@ format_dependency_version(struct sbuf *sbuf, const void *data,
}

/*
+
 * %e -- Description. string. Accepts field-width, left-align
+
 */
+
struct sbuf *
+
format_description(struct sbuf *sbuf, const void *data, struct percent_esc *p)
+
{
+
	const struct pkg	*pkg = data;
+
	const char		*descr;
+

+
	pkg_get(pkg, PKG_DESCR, &descr);
+
	return (string_val(sbuf, descr, p));
+
}
+

+
/*
 * %i -- Additional info. string. Accepts field-width, left-align
 */
struct sbuf *
modified libpkg/private/pkg_printf.h
@@ -116,6 +116,7 @@ typedef enum _fmt_code_t {
	PP_PKG_DEPENDENCY_ORIGIN,
	PP_PKG_DEPENDENCY_VERSION,
	PP_PKG_DEPENDENCIES,
+
	PP_PKG_DESCRIPTION,
	PP_PKG_ADDITIONAL_INFO,
	PP_PKG_LOCK_STATUS,
	PP_PKG_LICENSE_LOGIC,
@@ -192,6 +193,7 @@ _static struct sbuf *format_dependencies(struct sbuf *, const void *, struct per
_static struct sbuf *format_dependency_name(struct sbuf *, const void *, struct percent_esc *);
_static struct sbuf *format_dependency_origin(struct sbuf *, const void *, struct percent_esc *);
_static struct sbuf *format_dependency_version(struct sbuf *, const void *, struct percent_esc *);
+
_static struct sbuf *format_description(struct sbuf *, const void *, struct percent_esc *);
_static struct sbuf *format_add_info(struct sbuf *, const void *, struct percent_esc *);
_static struct sbuf *format_lock_status(struct sbuf *, const void *, struct percent_esc *);
_static struct sbuf *format_license_logic(struct sbuf *, const void *, struct percent_esc *);
@@ -224,11 +226,11 @@ _static struct sbuf *mode_val(struct sbuf *, mode_t, struct percent_esc *);
_static struct sbuf *liclog_val(struct sbuf *, lic_t, struct percent_esc *);
_static struct sbuf *list_count(struct sbuf *, int64_t, struct percent_esc *);

-
_static struct percent_esc *set_list_defaults(struct percent_esc *, const char *,
-
					     const char *);
+
_static struct percent_esc *set_list_defaults(struct percent_esc *,
+
					      const char *, const char *);

-
_static struct sbuf *iterate_item(struct sbuf *, const struct pkg *, const char *,
-
				 const void *, int, unsigned);
+
_static struct sbuf *iterate_item(struct sbuf *, const struct pkg *,
+
				  const char *, const void *, int, unsigned);

_static const char *field_modifier(const char *, struct percent_esc *);
_static const char *field_width(const char *, struct percent_esc *);