ECONF_NEWKEY..._WITH_OPTIONS(3)
π ECONF_NEWKEY..._WITH_OPTIONS(3) π
okay bestie, pull up a chair β this one's from the libeconf Manual and it's literally the glow-up version of making a fresh key file. π
β¨ NAME β¨
econf_newKeyFile_with_options β creates a brand-new econf_file object, but likeβ¦ with options. main character energy fr fr π
πΈ SYNOPSIS πΈ
#include <libeconf.h>
econf_err econf_newKeyFile_with_options(econf_file **result,
const char *options);
π¦ DESCRIPTION π¦
so the econf_newKeyFile_with_options() function does the thing: it makes a new, empty econf_file object and tucks it safely into *result. β¨
options is a string of <key>=<value> pairs, separated by ';' β like "JOIN_SAME_ENTRIES=1". if options is NULL or just an empty string, no stress: the new econf_file object gets created with the default settings described down below. π«Ά
these are the options that are supported:
JOIN_SAME_ENTRIES(default0) β parsed entries that have the same name won't get replaced; instead they get joined into one entry. no cap, they're bonding. π€PYTHON_STYLE(default0) β indentations get handled like multiline entries. very python-coded of them. πDEFAULT_QUOTES(default0) β entries that are newly created (think: viaeconf_setStringValue()) and not read from a file will have their value wrapped in quotes when theeconf_filegets written out to a file. and this default can be overridden per entry witheconf_setQuotes(). πPARSING_DIRS(default/usr/etc/:/run:/etc) β the list of directories that the configuration files have to be parsed from. the list is one string, divided by':'. the last entry has the highest priority. e.g.:"PARSING_DIRS=/usr/etc/:/run:/etc". πCONFIG_DIRS(default empty) β the list of directory structures (with order) that describes the directories where the files have to be parsed. the list is one string, divided by':'. the last entry has the highest priority. so like, with the list"CONFIG_DIRS=.conf.d:.d", files in these directories get parsed: β¬οΈ
<default_dirs>/<config_name>.conf.d/
<default_dirs>/<config_name>.d/
<default_dirs>/<config_name>/
ROOT_PREFIX(default empty) β a directory prefix used for all search directories, if specified. π
π RETURN VALUE π
if everything slays, this function returns ECONF_SUCCESS and stores the newly created econf_file object in *result. π
but if there's an error, a non-zero error code comes back (peep the βERRORSβ section below π), and *result may be set to NULL. π
π ERRORS π
ECONF_NOMEMβ not enough memory to allocate the neweconf_fileobject, or one of its internal lists. the malloc said nope. πECONF_OPTION_NOT_FOUNDβoptionscontains a key that isn't a known option. bestie, that flag doesn't exist. π«
β EXAMPLES β
#include <libeconf.h>
econf_file *key_file = NULL;
econf_err error;
if ((error = econf_newKeyFile_with_options(&key_file, "PYTHON_STYLE=1")))
{
fprintf (stderr, "ERROR: couldn't create new key file: %s\n",
econf_errString(error));
return 1;
}
error = econf_readConfig (&key_file,
"foo",
"/usr/lib",
"example",
"conf",
"=", "#");
econf_free (key_file);
key_file = NULL;
π₯ SEE ALSO π₯
libeconf(3), econf_newKeyFile(3), econf_newIniFile(3), econf_setQuotes(3), econf_freeFile(3), econf_errString(3)
okay that's the whole page, go forth and make key files πΈ β this was libeconf, dated 2026-10-15, version libeconf (yes the source and the version are the same word, iconic honestly). mwah, bye bestie ππ«Ά
π¦ where this page comes from
- nixpkgs unstable: libeconf 0.8.6
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms