ECONF\_NEWKEYFILE\_WITH\_OPTIONS(3) libeconf Manual ECONF\_NEWKEYFILE\_WITH\_OPTIONS(3)

# [NAME](#NAME)

econf\_newKeyFile\_with\_options - create a new econf\_file object with special options

# [SYNOPSIS](#SYNOPSIS)

```
#include <libeconf.h>
```

**econf\_err econf\_newKeyFile\_with\_options(econf\_file \*\*result, const char \*options);**

# [DESCRIPTION](#DESCRIPTION)

The **econf\_newKeyFile\_with\_options**() function creates a new, empty **econf\_file** object and stores it in *\*result*.

*options* is a string of **&lt;key&gt;=&lt;value&gt;** pairs separated by ';', e.g. **"JOIN\_SAME\_ENTRIES=1"**. If *options* is **NULL** or an empty string, the new **econf\_file** object is created with the default settings described below.

The following options are supported:

**JOIN\_SAME\_ENTRIES** (default 0)

Parsed entries with the same name will not be replaced but will be joined to one entry.

**PYTHON\_STYLE** (default 0)

Indentations will be handled like multiline entries.

**DEFAULT\_QUOTES** (default 0)

Entries which are newly created (e.g. via **econf\_setStringValue**()) and not read from a file will have their value enclosed by quotes when the **econf\_file** is written to a file. This default can be overridden per entry with **econf\_setQuotes**().

**PARSING\_DIRS** (default /usr/etc/:/run:/etc)

List of directories from which the configuration files have to be parsed. The list is a string, divided by ':'. The last entry has the highest priority. E.g.: **"PARSING\_DIRS=/usr/etc/:/run:/etc"**.

**CONFIG\_DIRS** (default empty)

List of directory structures (with order) which describes the directories in which the files have to be parsed. The list is a string, divided by ':'. The last entry has the highest priority. E.g. with the given list **"CONFIG\_DIRS=.conf.d:.d"** files in the following directories will be parsed:

&lt;default\_dirs&gt;/&lt;config\_name&gt;.conf.d/  
&lt;default\_dirs&gt;/&lt;config\_name&gt;.d/  
&lt;default\_dirs&gt;/&lt;config\_name&gt;/

**ROOT\_PREFIX** (default empty)

Directory prefix used for all search directories if specified.

# [RETURN VALUE](#RETURN_VALUE)

Upon successful completion, this function returns **ECONF\_SUCCESS** and stores the newly created **econf\_file** object in *\*result*.

On error, a non-zero error code is returned (see the section called “ERRORS”), and *\*result* may be set to **NULL**.

# [ERRORS](#ERRORS)

**ECONF\_NOMEM**

Insufficient memory to allocate the new **econf\_file** object or one of its internal lists.

**ECONF\_OPTION\_NOT\_FOUND**

*options* contains a key that is not a known option.

# [EXAMPLES](#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](#SEE_ALSO)

[**libeconf**(3)](/man/os/libeconf/libeconf.3), [**econf\_newKeyFile**(3)](/man/os/libeconf/econf_newKeyFile.3), [**econf\_newIniFile**(3)](/man/os/libeconf/econf_newIniFile.3), [**econf\_setQuotes**(3)](/man/os/libeconf/econf_setQuotes.3), [**econf\_freeFile**(3)](/man/os/libeconf/econf_freeFile.3), [**econf\_errString**(3)](/man/os/libeconf/econf_errString.3)

2026-10-15 libeconf

---

Document: econf_newKeyFile_with_options(3) from libeconf 0.8.6-r3 (Chainguard OS)
Source: https://github.com/openSUSE/libeconf
