|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflsymb.h"
char *
sym_get_value (
const SYMTAB *table, /* Symbol table to process */
const char *name, /* Name of symbol to look for */
const char *default_value) /* Value to return if not defined */
Returns value for specified symbol, if defined in table, or a default value otherwise. You can use this in situations where a symbol does not need to exist, and where frequent look-up by name is required. The symbol table must exist and be populated beforehand as appropriate. Returns a pointer to the value; you should never write to this string since it may exist as a string constant, not writable memory.
value = sym_get_value (env, "PATH", NULL);
if (!value)
puts ("PATH not defined");
{
SYMBOL
*symbol; /* Search through symbol table */
ASSERT (table);
symbol = sym lookup symbol (table, name);
if (symbol)
return (symbol-> value);
else
return ((char *) default_value);
}
| | << | < | > | >> |
|