diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-12-27 14:34:01 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-12-27 14:34:01 +0200 |
commit | a662047e2c43604bc087ec4dda9a7358368d850b (patch) | |
tree | e1f2b768f541315aa0d55f169f6b9af5ad96cb45 /src/app_del.c | |
parent | 6117de6eae69eeba6b401a231c7f60f71af152b7 (diff) | |
download | apk-tools-a662047e2c43604bc087ec4dda9a7358368d850b.tar.gz apk-tools-a662047e2c43604bc087ec4dda9a7358368d850b.tar.bz2 apk-tools-a662047e2c43604bc087ec4dda9a7358368d850b.tar.xz apk-tools-a662047e2c43604bc087ec4dda9a7358368d850b.zip |
print: improve indented printing api
- make sure all commit errors go to stderr
- make it a bit more api like
Diffstat (limited to 'src/app_del.c')
-rw-r--r-- | src/app_del.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/app_del.c b/src/app_del.c index f4c00fc..1df4cc9 100644 --- a/src/app_del.c +++ b/src/app_del.c @@ -68,14 +68,10 @@ static void print_not_deleted_pkg(struct apk_package *pkg0, struct apk_dependenc apk_msg(out, "World updated, but the following packages are not removed due to:"); ctx->header = 1; } - if (!ctx->indent.indent) { - ctx->indent.x = printf(" %s:", ctx->name->name); - ctx->indent.indent = ctx->indent.x + 1; - } - - if (name_in_world(pkg0->name)) { + if (!ctx->indent.indent) + apk_print_indented_group(&ctx->indent, 0, " %s:", ctx->name->name); + if (name_in_world(pkg0->name)) apk_print_indented(&ctx->indent, APK_BLOB_STR(pkg0->name->name)); - } foreach_array_item(d, pkg0->provides) { if (!name_in_world(d->name)) continue; apk_print_indented(&ctx->indent, APK_BLOB_STR(d->name->name)); @@ -98,14 +94,13 @@ static void print_not_deleted_name(struct apk_database *db, const char *match, struct not_deleted_ctx *ctx = (struct not_deleted_ctx *) pctx; struct apk_provider *p; - ctx->indent = (struct apk_indent) { .out = out }; ctx->name = name; ctx->matches = apk_foreach_genid() | APK_FOREACH_MARKED | APK_DEP_SATISFIES; + apk_print_indented_init(&ctx->indent, out, 0); foreach_array_item(p, name->providers) if (p->pkg->marked) print_not_deleted_pkg(p->pkg, NULL, NULL, ctx); - if (ctx->indent.indent) - printf("\n"); + apk_print_indented_end(&ctx->indent); } static void delete_pkg(struct apk_package *pkg0, struct apk_dependency *dep0, |