Commit fa2ee3e9 authored by Geoff Simmons's avatar Geoff Simmons

test_config: clarify some details about the CONF interface

parent adca670d
...@@ -34,8 +34,11 @@ ...@@ -34,8 +34,11 @@
* \brief Config handling interface * \brief Config handling interface
* \details Common functions to get configuration data * \details Common functions to get configuration data
* *
* This header defines the functions the plugin uses to get its * This header defines the functions used to get configuration data.
* configuration data. *
* If the conf_add() callback returns non-zero, CONF_ReadFile() prints
* an error message to `stderr` assuming that the return value is an
* errno value.
*/ */
...@@ -44,7 +47,7 @@ ...@@ -44,7 +47,7 @@
* *
* @param lval key * @param lval key
* @param rval value * @param rval value
* @return 0 on success, an error value on failure * @return 0 on success, an errno value on failure
*/ */
typedef int conf_add_f(const char *lval, const char *rval); typedef int conf_add_f(const char *lval, const char *rval);
......
...@@ -183,7 +183,7 @@ static char ...@@ -183,7 +183,7 @@ static char
TEST_catchStderrStart(); TEST_catchStderrStart();
err = CONF_ReadFile(confName, CONF_Add); err = CONF_ReadFile(confName, CONF_Add);
TEST_catchStderrEnd(); TEST_catchStderrEnd();
VMASSERT(err == -1, "Wrong error code during reading config \"%s\": %i", VMASSERT(err < 0, "Wrong error code during reading config \"%s\": %i",
confName, err); confName, err);
err = TEST_stderrEquals(errmsg); err = TEST_stderrEquals(errmsg);
VMASSERT(err == 0, VMASSERT(err == 0,
......
...@@ -331,6 +331,13 @@ struct config { ...@@ -331,6 +331,13 @@ struct config {
void CONF_Init(void); void CONF_Init(void);
int CONF_Add(const char *lval, const char *rval); int CONF_Add(const char *lval, const char *rval);
/**
* Reads the default config file `/etc/trackrdrd.conf`, if present
*
* @returns 0 if the file does not exist or was successfully read,
* >0 (errno) if the file exists but cannot be read,
* <0 if the file was read but the contents could not be processed
*/
int CONF_ReadDefault(void); int CONF_ReadDefault(void);
void CONF_Dump(void); void CONF_Dump(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment