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

 

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)

{
    static char
        variable_name [LINE_MAX];
    char
        *variable_value;

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

| << | < | > | >> iMatix Copyright © 1996-98 iMatix