summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-04-25 05:45:39 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-04-25 05:45:39 (EDT)
commitd6813160f258d24681e7da9788618608b7c6cf35 (patch)
treee3e698bb5c0c15504cb6ffaaefc0a6b1add97343
parent28ea2b9718162761b5de617efa74ae2bd020acb2 (diff)
opk: Print linkname
-rw-r--r--src/opk.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/opk.c b/src/opk.c
index 6d31185..2747345 100644
--- a/src/opk.c
+++ b/src/opk.c
@@ -235,8 +235,8 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk)
size_t gname_len_max;
uint64_t size_max;
long int size_len_max;
- char fmt[29];
- /* "%c%s %-32s/%-32s %11d %s %s\n" */
+ char fmt[28];
+ /* "%c%s %-32s/%-32s %11d %s %s" */
size_t len;
char mode[10];
char mtime[20];
@@ -287,9 +287,9 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk)
/* Print and free members. */
ret = OPKG_OPK_OK;
size_len_max = lrint(ceil(log10(size_max)));
- snprintf(fmt, sizeof(fmt), "%%c%%s %%-%zus/%%-%zus %%%lid %%s %%s\n",
+ snprintf(fmt, sizeof(fmt), "%%c%%s %%-%zus/%%-%zus %%%lid %%s %%s",
uname_len_max, gname_len_max, size_len_max);
- len = 35 + uname_len_max + gname_len_max + size_len_max;
+ len = 34 + uname_len_max + gname_len_max + size_len_max;
for (member = head; member != NULL;) {
if (member->mode & 00400) mode[0] = 'r'; else mode[0] = '-';
if (member->mode & 00200) mode[1] = 'w'; else mode[1] = '-';
@@ -315,6 +315,13 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk)
ret = OPKG_OPK_ERROR;
}
#pragma GCC diagnostic pop
+ if (member->type == 'l' && printf(" -> %s", member->linkname) !=
+ (int) (strlen(member->linkname) + 4)) {
+ ret = OPKG_OPK_ERROR;
+ }
+ if (puts("") == EOF) {
+ ret = OPKG_OPK_ERROR;
+ }
head = member;
member = member->next;
free(head);