summaryrefslogtreecommitdiff
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-01-13 15:22:14 +0200
committerTimo Teras <timo.teras@iki.fi>2009-01-13 15:22:14 +0200
commitb7f9f9bdb21ffeb50f5814fdcce2f315215fdb1e (patch)
treea77d7e52c7d61b6601ea6f0021bd529da3e85dbe /src/package.c
parentc831ead63c5fdb4d1e75c264084576cfefe581e6 (diff)
downloadapk-tools-b7f9f9bdb21ffeb50f5814fdcce2f315215fdb1e.tar.gz
apk-tools-b7f9f9bdb21ffeb50f5814fdcce2f315215fdb1e.tar.bz2
apk-tools-b7f9f9bdb21ffeb50f5814fdcce2f315215fdb1e.tar.xz
apk-tools-b7f9f9bdb21ffeb50f5814fdcce2f315215fdb1e.zip
info: implement who owns packages query (apk_info -W)
In quiet mode e.g. "apk info -q -W <file list>" a list of dependencies suitable for .PKGINFO is output in one line.
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/package.c b/src/package.c
index 40fc871..59ca93a 100644
--- a/src/package.c
+++ b/src/package.c
@@ -141,13 +141,13 @@ int apk_deps_format(char *buf, int size,
if (depends == NULL)
return 0;
- for (i = 0; i < depends->num - 1; i++)
+ for (i = 0; i < depends->num; i++) {
+ if (i && n < size)
+ buf[n++] = ' ';
n += snprintf(&buf[n], size-n,
- "%s ",
+ "%s",
depends->item[i].name->name);
- n += snprintf(&buf[n], size-n,
- "%s\n",
- depends->item[i].name->name);
+ }
return n;
}
@@ -545,6 +545,8 @@ apk_blob_t apk_pkg_format_index_entry(struct apk_package *info, int size,
if (info->depends != NULL) {
n += snprintf(&buf[n], size-n, "D:");
n += apk_deps_format(&buf[n], size-n, info->depends);
+ if (n < size)
+ buf[n++] = '\n';
}
n += snprintf(&buf[n], size-n, "C:");
n += apk_hexdump_format(size-n, &buf[n],