| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

env_get_string

#include "sflenv.h"
char *
env_get_string (
    const char *name,
    const char *default_value)

Synopsis

Translates the specified environment variable and returns a static string containing the value. If the variable is not defined in the environment, returns the specified default value. Note: if you want to use the value in a program you should use strdupl() to make a copy. The environment variable name is always translated into upper case. The default value may be NULL.

Examples

    config_file = strdupl (env_get_string ("config", "default.cfg"));

Source Code - (sflenv.c)

{
    char
        *variable_name,
        *variable_value;

    variable_name = mem_strdup (name);
    variable_value = getenv (strupc (variable_name));
    mem_free (variable_name);
    return (variable_value? variable_value: (char *) default_value);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation