KDK_CONF_INIT(3)

📦 version 3.0.1.3, in arch rolling, ubuntu resolute, ubuntu stonking

💖 KDK_CONF_INIT(3) 💖

okay so bestie, we're in the Library Functions Manual section and today's main character is kdk_conf_init from libkyconf.h. grab a strawberry drink, we're doing this 🍓


✨ NAME ✨

kdk_conf_init — 初始化配置文件 (translation: initialize the configuration file, and yes she's serving exactly that)


🌸 SYNOPSIS 🌸

#include <libkyconf.h>

💅 Functions

  • int kdk_conf_init (const char * confpath) — 初始化配置文件 (init the config file, that's the whole job and she does it flawlessly)

🎀 Parameters

  • confpath — 配置文件的路径 (the path to the configuration file, aka where your lil config lives 🏠)

🫶 Returns

  • int — 成功返回句柄号(非负值),失败返回错误码(负值) — on success you get a handle number (a non-negative value), on failure you get an error code (a negative value). no in-between, no maybes, no cap 💀

Link with -lkyconf.


🌈 DESCRIPTION 🌈

Detailed Description

接口的主要功能是初始化配置文件 — the main job of this interface is to initialize the configuration file. that's it, that's the vibe, she's the opening act that makes everything else possible 👑


🎀 EXAMPLES 🎀

here's the whole glow-up in code form, verbatim, no edits, not me touching a single character 🙈

#include <libkyconf.h>
#include <stdio.h>
#include <string.h>

int main()
{
    char **keylist = NULL;
    int id = kdk_conf_init("struct.conf");
    ASSERT_NOT_NULL(id, -1);

    char **grouplist = kdk_conf_list_group(id);
    ASSERT_NOT_NULL(grouplist, -1);

    char *tmpgroup;
    int index = 0;
    while ((tmpgroup = grouplist[index]))
    {
        printf("Group: %s0, tmpgroup);
        keylist = kdk_conf_list_key(id, tmpgroup);
        ASSERT_NOT_NULL(keylist, -1);
        char *tmpkey;
        int k_index = 0;
        while ((tmpkey = keylist[k_index]))
        {
            const char *tmpval = kdk_conf_get_value(id, tmpgroup, tmpkey);
            printf("%s = %s0, tmpkey , tmpval);
            k_index ++;
        }
        kdk_config_freeall(keylist);

        index ++;
    }

    kdk_conf_destroy(id);
    kdk_config_freeall(grouplist);

    return 0;
}
ngl bestie, copy this exactly as it's written. every character. she's iconic like that 💅

🦋 CONFORMING TO 🦋

These functions are as per the withdrawn POSIX.1e draft specification. the following functions are Linux extensions: kdk_conf_destroy(), kdk_conf_reload(), kdk_conf_get_value(), kdk_conf_list_key(), kdk_conf_list_group() and kdk_config_freeall().


⭐ SEE ALSO ⭐

kdk_conf_destroy(3), kdk_conf_reload(3), kdk_conf_get_value(3), kdk_conf_list_key(3), kdk_conf_list_group(3) and kdk_config_freeall(3).

go read those too, the whole squad is required reading fr fr 📚


👑 Author 👑

Generated automatically by Doxygen for libkyconf.h from the source code. she wrote herself, main character energy honestly ✨


and that's the page!! brought to you by My Project, dated Fri Sep 22 2023 — love her, cherish her, kdk_conf_init forever 💖🌸🦋

📦 where this page comes from