3 * $Id: env.h,v 1.2 1999/12/10 23:42:04 mdw Exp $
5 * Fiddling with environment variables
7 * (c) 1999 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the mLib utilities library.
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * mLib is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with mLib; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Revision history --------------------------------------------------*
33 * Revision 1.2 1999/12/10 23:42:04 mdw
34 * Change header file guard names.
36 * Revision 1.1 1999/07/26 23:15:57 mdw
37 * Fiddling with environment variables.
48 /*----- Header files ------------------------------------------------------*/
54 /*----- Functions provided ------------------------------------------------*/
56 /* --- @env_get@ --- *
58 * Arguments: @sym_table *t@ = pointer to a symbol table
59 * @const char *name@ = pointer to variable name to look up
61 * Returns: Pointer to corresponding value string, or null.
63 * Use: Looks up an environment variable in the table and returns its
64 * value. If the variable can't be found, a null pointer is
68 extern char *env_get(sym_table */*t*/, const char */*name*/);
70 /* --- @env_put@ --- *
72 * Arguments: @sym_table *t@ = pointer to a symbol table
73 * @const char *name@ = pointer to variable name to set
74 * @const char *value@ = pointer to value string to assign
78 * Use: Assigns a value to a variable. If the @name@ contains an
79 * equals character, then it's assumed to be of the form
80 * `VAR=VALUE' and @value@ argument is ignored. Otherwise, if
81 * @value@ is null, the variable is deleted. Finally, the
82 * normal case: @name@ is a plain name, and @value@ is a normal
83 * string causes the variable to be assigned the value in the
87 extern void env_put(sym_table */*t*/,
88 const char */*name*/, const char */*value*/);
90 /* --- @env_import@ --- *
92 * Arguments: @sym_table *t@ = pointer to a symbol table
93 * @char **env@ = pointer to an environment list
97 * Use: Inserts all of the environment variables listed into a symbol
98 * table for rapid access. Equivalent to a lot of calls to
102 extern void env_import(sym_table */*t*/, char **/*env*/);
104 /* --- @env_export@ --- *
106 * Arguments: @sym_table *t@ = pointer to a symbol table
108 * Returns: A big environment list.
110 * Use: Extracts an environment table from a symbol table
111 * representation of an environment. The table and all of the
112 * strings are in one big block allocated from the heap.
115 extern char **env_export(sym_table */*t*/);
117 /* --- @env_destroy@ --- *
119 * Arguments: @sym_table *t@ = pointer to symbol table
123 * Use: Destroys all the variables in the symbol table.
126 extern void env_destroy(sym_table */*t*/);
128 /*----- That's all, folks -------------------------------------------------*/