From f73461a854574f45e5fd5b5ad1c7379e754847de Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 30 Oct 2015 14:10:01 +0100 Subject: [PATCH] xbps-query: fix printing the alternatives obj. --- bin/xbps-query/show-info-files.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/xbps-query/show-info-files.c b/bin/xbps-query/show-info-files.c index 2a8a97f1..41cfd161 100644 --- a/bin/xbps-query/show-info-files.c +++ b/bin/xbps-query/show-info-files.c @@ -88,6 +88,8 @@ print_value_obj(const char *keyname, xbps_object_t obj, } break; case XBPS_TYPE_DICTIONARY: + if (!raw) + printf("%s%s%s%s:\n", indent, bold, keyname, reset); allkeys = xbps_dictionary_all_keys(obj); for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) { keysym = xbps_array_get(allkeys, i); @@ -131,6 +133,7 @@ show_pkg_info_one(xbps_dictionary_t d, const char *keys) const char *bold, *reset; char *key, *p, *saveptr; int v_tty = isatty(STDOUT_FILENO); + bool raw; if (v_tty) { bold = _BOLD; @@ -144,7 +147,10 @@ show_pkg_info_one(xbps_dictionary_t d, const char *keys) obj = xbps_dictionary_get(d, keys); if (obj == NULL) return; - print_value_obj(keys, obj, NULL, bold, reset, true); + raw = true; + if (xbps_object_type(obj) == XBPS_TYPE_DICTIONARY) + raw = false; + print_value_obj(keys, obj, NULL, bold, reset, raw); return; } key = strdup(keys); @@ -155,7 +161,10 @@ show_pkg_info_one(xbps_dictionary_t d, const char *keys) obj = xbps_dictionary_get(d, p); if (obj == NULL) continue; - print_value_obj(p, obj, NULL, bold, reset, true); + raw = true; + if (xbps_object_type(obj) == XBPS_TYPE_DICTIONARY) + raw = false; + print_value_obj(p, obj, NULL, bold, reset, raw); } free(key); }