#include "cobenv.h" cobchar_t *cobgetenv(const cobchar_t *name);
name | A null-terminated string, specifying the environment variable name to be searched for. |
display name upon environment-name accept ... from environment-value
The following code displays the value of $COBDIR:
cobchar_t *cobdir; if ((cobdir = cobgetenv("COBDIR")) == NULL) cobdir = "<unset>"; cobprintf("COBDIR=%s\n", cobdir); cobchar_t *cobdir; if ((cobdir = cobgetenv("COBDIR")) == NULL) cobdir = "<unset>"; printf("COBDIR=%s\n", cobdir);
Comments:
This function provides the same functionality as the C library call getenv(). The specified environment variable is searched for and returned. If the environment variable does not exist then NULL is returned.