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> | 2023-03-03 13:00:10 +0200 |
commit | d351992ad529dccb95fc1c8997cd328e9c694a92 (patch) | |
tree | d4d54f32b1254b779557eea82fd78391c0063661 /src/app_del.c | |
parent | fd8f39f1d54c3b56d16a494898e5a753e2c71715 (diff) | |
download | apk-tools-2.12-stable.tar.gz apk-tools-2.12-stable.tar.bz2 apk-tools-2.12-stable.tar.xz apk-tools-2.12-stable.zip |
print: improve indented printing api2.12-stable
- make sure all commit errors go to stderr
- make it a bit more api like
(cherry picked and rebased from commit a662047e2c43604bc087ec4dda9a7358368d850b)
fixes #10879
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 c8a9e36..7d3cf36 100644 --- a/src/app_del.c +++ b/src/app_del.c @@ -66,14 +66,10 @@ static void print_not_deleted_pkg(struct apk_package *pkg0, struct apk_dependenc apk_message("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)); @@ -95,14 +91,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.indent = 0; ctx->name = name; ctx->matches = apk_foreach_genid() | APK_FOREACH_MARKED | APK_DEP_SATISFIES; + apk_print_indented_init(&ctx->indent, 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, |