along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <stdio.h>
#include <string.h>
#include <urcu.h>
knot_lmdb_commit(&txn_w);
return txn_w.ret;
}
-
-static void print_dname(const knot_dname_t *d)
-{
- knot_dname_txt_storage_t tmp;
- knot_dname_to_str(tmp, d, sizeof(tmp));
- printf("%s ", tmp);
-}
-
-static void print_dname3(const char *prefix, const knot_dname_t *a,
- const knot_dname_t *b,const knot_dname_t *c)
-{
- printf("%s", prefix);
- print_dname(a);
- print_dname(b);
- print_dname(c);
- printf("\n");
-}
-
-static int catalog_print_cb(const knot_dname_t *mem, const knot_dname_t *ow,
- const knot_dname_t *cz, void *ctx)
-{
- print_dname3("", mem, ow, cz);
- (*(ssize_t *)ctx)++;
- return KNOT_EOK;
-}
-
-void catalog_print(catalog_t *cat)
-{
- ssize_t total = 0;
-
- printf(";; <catalog zone> <record owner> <record zone>\n");
-
- if (cat != NULL) {
- int ret = catalog_open(cat);
- if (ret == KNOT_EOK) {
- ret = catalog_apply(cat, NULL, catalog_print_cb, &total, false);
- }
- if (ret != KNOT_EOK) {
- printf("Catalog print failed (%s)\n", knot_strerror(ret));
- return;
- }
- }
-
- printf("Total records: %zd\n", total);
-}
* \return KNOT_E*
*/
int catalog_copy(knot_lmdb_db_t *from, knot_lmdb_db_t *to,
- const knot_dname_t *zone_only, bool read_rw_txn);
-
-/*!
- * \brief Print to stdout whole contents of catalog database (for human).
- *
- * \param cat Catalog database to be printed.
- */
-void catalog_print(catalog_t *cat);
+ const knot_dname_t *cat_only, bool read_rw_txn);
-/* Copyright (C) 2020 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
PROGRAM_NAME);
}
+static void print_dname(const knot_dname_t *d)
+{
+ knot_dname_txt_storage_t tmp;
+ knot_dname_to_str(tmp, d, sizeof(tmp));
+ printf("%s ", tmp);
+}
+
+static int catalog_print_cb(const knot_dname_t *mem, const knot_dname_t *ow,
+ const knot_dname_t *cz, void *ctx)
+{
+ print_dname(mem);
+ print_dname(ow);
+ print_dname(cz);
+ printf("\n");
+ (*(ssize_t *)ctx)++;
+ return KNOT_EOK;
+}
+
+static void catalog_print(catalog_t *cat)
+{
+ ssize_t total = 0;
+
+ printf(";; <catalog zone> <record owner> <record zone>\n");
+
+ if (cat != NULL) {
+ int ret = catalog_open(cat);
+ if (ret == KNOT_EOK) {
+ ret = catalog_apply(cat, NULL, catalog_print_cb, &total, false);
+ }
+ if (ret != KNOT_EOK) {
+ printf("Catalog print failed (%s)\n", knot_strerror(ret));
+ return;
+ }
+ }
+
+ printf("Total records: %zd\n", total);
+}
+
int main(int argc, char *argv[])
{
struct option options[] = {