summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-04-30 09:57:44 -0400
committerDave Reisner <dreisner@archlinux.org>2013-04-30 09:57:56 -0400
commit1cef52795c44bb41db5afa220f423993478d8d83 (patch)
tree06340304a9beb5781fabf7f72d37928800a6bfd2
parent37ee2520b568028872fb13677359f6c31a316dc1 (diff)
downloadexpac-1cef52795c44bb41db5afa220f423993478d8d83.tar.xz
support optdepends as alpm_depend_t
Fixes FS#35035.
-rw-r--r--expac.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/expac.c b/expac.c
index c971bb1..75bb7aa 100644
--- a/expac.c
+++ b/expac.c
@@ -137,15 +137,23 @@ static char *strtrim(char *str) {
return str;
}
-static char *trim_optdep(char *optdep) {
+static char *format_optdep(alpm_depend_t *optdep) {
+ char *out;
+
+ asprintf(&out, "%s: %s", optdep->name, optdep->desc);
+
+ return out;
+}
+
+static char *trim_optdep(alpm_depend_t *optdep) {
char *colon;
- colon = strchr(optdep, ':');
+ colon = strchr(optdep->name, ':');
if (colon) {
*colon = '\0';
}
- return optdep;
+ return optdep->name;
}
static alpm_handle_t *alpm_init(void) {
@@ -567,7 +575,7 @@ static int print_pkg(alpm_pkg_t *pkg, const char *format) {
out += print_list(alpm_pkg_get_depends(pkg), (extractfn)alpm_dep_compute_string, shortdeps);
break;
case 'O': /* optdepends */
- out += print_list(alpm_pkg_get_optdepends(pkg), NULL, shortdeps);
+ out += print_list(alpm_pkg_get_optdepends(pkg), (extractfn)format_optdep, shortdeps);
break;
case 'o': /* optdepends (shortdeps) */
out += print_list(alpm_pkg_get_optdepends(pkg), (extractfn)trim_optdep, shortdeps);