diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_install/info/show.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index a1f9e8d..c65c312 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -213,6 +213,7 @@ show_files(const char *title, Package *plist) { PackingList p; Boolean ign = FALSE; + char *prefix = NULL; const char *dir = "."; if (!Quiet) @@ -227,7 +228,12 @@ show_files(const char *title, Package *plist) break; case PLIST_CWD: - dir = p->name; + if (!prefix) + prefix = p->name; + if (p->name == NULL) + dir = prefix; + else + dir = p->name; break; case PLIST_IGNORE: @@ -255,6 +261,7 @@ show_size(const char *title, Package *plist) long blksize; int headerlen; char *descr; + char *prefix = NULL; descr = getbsize(&headerlen, &blksize); if (!Quiet) @@ -274,7 +281,12 @@ show_size(const char *title, Package *plist) break; case PLIST_CWD: - dir = p->name; + if (!prefix) + prefix = p->name; + if (p->name == NULL) + dir = prefix; + else + dir = p->name; break; case PLIST_IGNORE: @@ -301,15 +313,21 @@ show_cksum(const char *title, Package *plist) { PackingList p; const char *dir = "."; + char *prefix = NULL; char tmp[FILENAME_MAX]; if (!Quiet) printf("%s%s", InfoPrefix, title); for (p = plist->head; p != NULL; p = p->next) - if (p->type == PLIST_CWD) - dir = p->name; - else if (p->type == PLIST_FILE) { + if (p->type == PLIST_CWD) { + if (!prefix) + prefix = p->name; + if (p->name == NULL) + dir = prefix; + else + dir = p->name; + } else if (p->type == PLIST_FILE) { snprintf(tmp, FILENAME_MAX, "%s/%s", dir, p->name); if (!fexists(tmp)) warnx("%s doesn't exist", tmp); |