summaryrefslogtreecommitdiff
path: root/src/context.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-10-05 18:52:51 +0300
committerTimo Teräs <timo.teras@iki.fi>2020-10-09 16:09:19 +0300
commit354713d2f746c197eed6a1feb4c6af3420af6c15 (patch)
treef9dd51bbdde0f25f8e122832cf006076b8452d28 /src/context.c
parent7a7eca86709fcf31dbb1acf8b82ff411828fb67b (diff)
downloadapk-tools-354713d2f746c197eed6a1feb4c6af3420af6c15.tar.gz
apk-tools-354713d2f746c197eed6a1feb4c6af3420af6c15.tar.bz2
apk-tools-354713d2f746c197eed6a1feb4c6af3420af6c15.tar.xz
apk-tools-354713d2f746c197eed6a1feb4c6af3420af6c15.zip
rename apk_db_options to apk_ctx, rework logging
makes apk_verbosity non-global fixes #10682
Diffstat (limited to 'src/context.c')
-rw-r--r--src/context.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/context.c b/src/context.c
new file mode 100644
index 0000000..f7b745c
--- /dev/null
+++ b/src/context.c
@@ -0,0 +1,27 @@
+/* context.c - Alpine Package Keeper (APK)
+ *
+ * Copyright (C) 2005-2008 Natanael Copa <n@tanael.org>
+ * Copyright (C) 2008-2020 Timo Teräs <timo.teras@iki.fi>
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-only
+ */
+
+#include "apk_context.h"
+
+void apk_ctx_init(struct apk_ctx *ac)
+{
+ memset(ac, 0, sizeof *ac);
+ apk_string_array_init(&ac->repository_list);
+ apk_string_array_init(&ac->private_keys);
+ apk_out_reset(&ac->out);
+ ac->out.out = stdout;
+ ac->out.err = stderr;
+ ac->out.verbosity = 1;
+}
+
+void apk_ctx_free(struct apk_ctx *ac)
+{
+ apk_string_array_free(&ac->repository_list);
+ apk_string_array_free(&ac->private_keys);
+}