| iMatix home page | << | < | > | >> |
![]() Version 1.91 |
#include "sflenv.h" SYMTAB * env2symb (void)
Creates a symbol table containing the environment variables. Each variable is stored as a name plus value. You can destroy the symbol table using sym delete table() when you are finished with it.
{ SYMTAB *symtab; /* Allocated symbol table */ char *next_entry, /* Environment variable + value */ *equals; /* Position of '=' in string */ int string_nbr; /* Index into string table */ /* We create the table here, instead of passing through strt2symb(), since we have to ensure that environment variable names are stored in uppercase. Some systems (NT) return mixed-case names. */ symtab = sym create table (); if (symtab) { for (string_nbr = 0; environ [string_nbr]; string_nbr++) { next_entry = mem_strdup (environ [string_nbr]); equals = strchr (next_entry, '='); if (equals) { *equals = '\0'; /* Cut into two strings */ strupc (next_entry); sym assume symbol (symtab, next_entry, equals + 1); } mem_free (next_entry); } } return (symtab); }
| << | < | > | >> |
![]() |