Skip to content
Snippets Groups Projects
Commit 8f9e17cb authored by Daniel Salzman's avatar Daniel Salzman
Browse files

confio: rename conf-desc to conf-list

parent 7041e6b1
No related branches found
No related tags found
1 merge request!481Knotc cleanup
......@@ -158,7 +158,7 @@ int conf_io_abort(
return KNOT_EOK;
}
static int desc_section(
static int list_section(
const yp_item_t *items,
const yp_item_t **item,
conf_io_t *io)
......@@ -173,7 +173,7 @@ static int desc_section(
return KNOT_EOK;
}
int conf_io_desc(
int conf_io_list(
const char *key0,
conf_io_t *io)
{
......@@ -187,7 +187,7 @@ int conf_io_desc(
if (key0 == NULL) {
io_reset_val(io, NULL, NULL, NULL, 0, false, NULL);
return desc_section(conf()->scheme, &io->key0, io);
return list_section(conf()->scheme, &io->key0, io);
}
yp_check_ctx_t *ctx = yp_scheme_check_init(conf()->scheme);
......@@ -198,7 +198,7 @@ int conf_io_desc(
// Check the input.
int ret = yp_scheme_check_str(ctx, key0, NULL, NULL, NULL);
if (ret != KNOT_EOK) {
goto desc_error;
goto list_error;
}
yp_node_t *node = &ctx->nodes[ctx->current];
......@@ -206,13 +206,13 @@ int conf_io_desc(
// Check for non-group item.
if (node->item->type != YP_TGRP) {
ret = KNOT_ENOTSUP;
goto desc_error;
goto list_error;
}
io_reset_val(io, node->item, NULL, NULL, 0, false, NULL);
ret = desc_section(node->item->sub_items, &io->key1, io);
desc_error:
ret = list_section(node->item->sub_items, &io->key1, io);
list_error:
yp_scheme_check_deinit(ctx);
return ret;
......
......@@ -108,14 +108,14 @@ int conf_io_abort(
);
/*!
* Gets the configuration group item subsection list.
* Gets the configuration sections list or section items list.
*
* \param[in] key0 Section name (NULL to get section list).
* \param[out] io Operation output.
*
* \return Error code, KNOT_EOK if success.
*/
int conf_io_desc(
int conf_io_list(
const char *key0,
conf_io_t *io
);
......
......@@ -498,6 +498,7 @@ const cmd_desc_old_t cmd_table_old[] = {
{ "flush", CMD_ZONE_FLUSH },
{ "signzone", CMD_ZONE_SIGN },
{ "checkconf", CMD_CONF_CHECK },
{ "conf-desc", CMD_CONF_LIST },
{ NULL }
};
......
......@@ -726,7 +726,7 @@ static void test_conf_io_diff()
ok(conf_io_abort(false) == KNOT_EOK, "abort txn");
}
static void test_conf_io_desc()
static void test_conf_io_list()
{
const char *ref;
char out[OUT_LEN];
......@@ -737,17 +737,17 @@ static void test_conf_io_desc()
};
// ERR.
ok(conf_io_desc("", &io) ==
KNOT_YP_EINVAL_ITEM, "desc empty key0");
ok(conf_io_desc("uknown", &io) ==
KNOT_YP_EINVAL_ITEM, "desc unknown key0");
ok(conf_io_desc("include", &io) ==
KNOT_ENOTSUP, "desc non-group item");
ok(conf_io_list("", &io) ==
KNOT_YP_EINVAL_ITEM, "list empty key0");
ok(conf_io_list("uknown", &io) ==
KNOT_YP_EINVAL_ITEM, "list unknown key0");
ok(conf_io_list("include", &io) ==
KNOT_ENOTSUP, "list non-group item");
// Desc schema.
*out = '\0';
ok(conf_io_desc(NULL, &io) ==
KNOT_EOK, "desc schema");
ok(conf_io_list(NULL, &io) ==
KNOT_EOK, "list schema");
ref = "server\n"
"remote\n"
"template\n"
......@@ -757,8 +757,8 @@ static void test_conf_io_desc()
// Desc group.
*out = '\0';
ok(conf_io_desc("server", &io) ==
KNOT_EOK, "desc group");
ok(conf_io_list("server", &io) ==
KNOT_EOK, "list group");
ref = "server.version\n"
"server.rate-limit\n"
"server.listen";
......@@ -835,8 +835,8 @@ int main(int argc, char *argv[])
diag("conf_io_diff");
test_conf_io_diff();
diag("conf_io_desc");
test_conf_io_desc();
diag("conf_io_list");
test_conf_io_list();
conf_free(conf());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment