Refactored expand_vars so that a custom lookup function can be used, which makes it usable for replacing tags by values other than environment variables

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
This commit is contained in:
Dennis Potman 2020-02-24 14:03:25 +01:00 committed by eboasson
parent 24e42fd658
commit b3c5a8d4fc
14 changed files with 180 additions and 49 deletions

View file

@ -26,7 +26,7 @@ CU_Theory((const char *name), ddsrt_environ, bad_name)
dds_return_t rc;
static const char value[] = "bar";
static char dummy[] = "foobar";
char *ptr;
const char *ptr;
rc = ddsrt_setenv(name, value);
CU_ASSERT_EQUAL(rc, DDS_RETCODE_BAD_PARAMETER);
@ -71,7 +71,7 @@ CU_Test(ddsrt_environ, getenv)
static const char name[] = "foo";
static const char value[] = "bar";
static char dummy[] = "foobar";
char *ptr;
const char *ptr;
/* Ensure "not found" is returned. */
rc = ddsrt_unsetenv(name);

View file

@ -57,7 +57,7 @@ static int test_pid(void)
static int test_env(void)
{
int ret = TEST_EXIT_FAILURE;
char *envptr = NULL;
const char *envptr = NULL;
if (ddsrt_getenv(TEST_ENV_VAR_NAME, &envptr) == DDS_RETCODE_OK) {
printf(" Process: env %s=%s.\n", TEST_ENV_VAR_NAME, envptr);
if (strcmp(envptr, TEST_ENV_VAR_VALUE) == 0) {