18.2.161. PMIx_Envar_load

PMIx_Envar_load — Populate a pmix_envar_t(5) structure with an environment variable name, value, and separator.

18.2.161.1. SYNOPSIS

#include <pmix.h>

void PMIx_Envar_load(pmix_envar_t *e,
                     char *var,
                     char *value,
                     char separator);

18.2.161.1.1. Python Syntax

No Python equivalent

18.2.161.2. INPUT PARAMETERS

  • e: Pointer to a previously constructed pmix_envar_t(5) structure to be populated.

  • var: Name of the environment variable. If non-NULL, a copy of the string is stored in the envar field.

  • value: Value to associate with the environment variable. If non-NULL, a copy of the string is stored in the value field.

  • separator: Character used to separate multiple values when composing an aggregate value for the variable (for example, ':' for PATH-style variables). Stored in the separator field.

18.2.161.3. DESCRIPTION

Populate the fields of a pmix_envar_t structure. The var and value strings are each duplicated into newly allocated storage owned by the structure; the caller retains ownership of the strings it passed in. If var (or value) is NULL, the corresponding field is left unchanged. The separator character is copied directly.

The target structure should have been initialized with PMIx_Envar_construct(3) (or created with PMIx_Envar_create(3)) before loading, so that its pointer fields hold known values.

18.2.161.4. RETURN VALUE

PMIx_Envar_load returns no value (void).

18.2.161.5. NOTES

Because PMIx_Envar_load copies the supplied strings, the memory it allocates must eventually be released with PMIx_Envar_destruct(3) (for a single caller-owned structure) or PMIx_Envar_free(3) (for an array obtained from PMIx_Envar_create(3)).

18.2.161.6. EXAMPLES

Load a colon-separated PATH addition:

pmix_envar_t envar;

PMIx_Envar_construct(&envar);
PMIx_Envar_load(&envar, "PATH", "/opt/bin", ':');

/* ... use the structure ... */

PMIx_Envar_destruct(&envar);