3 * $Id: env.h,v 1.1 1999/07/26 23:15:57 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.1 1999/07/26 23:15:57 mdw
34 * Fiddling with environment variables.
45 /*----- Header files ------------------------------------------------------*/
51 /*----- Functions provided ------------------------------------------------*/
53 /* --- @env_get@ --- *
55 * Arguments: @sym_table *t@ = pointer to a symbol table
56 * @const char *name@ = pointer to variable name to look up
58 * Returns: Pointer to corresponding value string, or null.
60 * Use: Looks up an environment variable in the table and returns its
61 * value. If the variable can't be found, a null pointer is
65 extern char *env_get(sym_table */
*t*/
, const char */
*name*/
);
67 /* --- @env_put@ --- *
69 * Arguments: @sym_table *t@ = pointer to a symbol table
70 * @const char *name@ = pointer to variable name to set
71 * @const char *value@ = pointer to value string to assign
75 * Use: Assigns a value to a variable. If the @name@ contains an
76 * equals character, then it's assumed to be of the form
77 * `VAR=VALUE' and @value@ argument is ignored. Otherwise, if
78 * @value@ is null, the variable is deleted. Finally, the
79 * normal case: @name@ is a plain name, and @value@ is a normal
80 * string causes the variable to be assigned the value in the
84 extern void env_put(sym_table */
*t*/
,
85 const char */
*name*/
, const char */
*value*/
);
87 /* --- @env_import@ --- *
89 * Arguments: @sym_table *t@ = pointer to a symbol table
90 * @char **env@ = pointer to an environment list
94 * Use: Inserts all of the environment variables listed into a symbol
95 * table for rapid access. Equivalent to a lot of calls to
99 extern void env_import(sym_table */
*t*/
, char **/
*env*/
);
101 /* --- @env_export@ --- *
103 * Arguments: @sym_table *t@ = pointer to a symbol table
105 * Returns: A big environment list.
107 * Use: Extracts an environment table from a symbol table
108 * representation of an environment. The table and all of the
109 * strings are in one big block allocated from the heap.
112 extern char **env_export(sym_table */
*t*/
);
114 /* --- @env_destroy@ --- *
116 * Arguments: @sym_table *t@ = pointer to symbol table
120 * Use: Destroys all the variables in the symbol table.
123 extern void env_destroy(sym_table */
*t*/
);
125 /*----- That's all, folks -------------------------------------------------*/