chiark / gitweb /
Remove spurious space from the synopsis section.
[mLib] / env.h
CommitLineData
e19206c2 1/* -*-c-*-
2 *
3 * $Id: env.h,v 1.1 1999/07/26 23:15:57 mdw Exp $
4 *
5 * Fiddling with environment variables
6 *
7 * (c) 1999 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of the mLib utilities library.
13 *
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.
18 *
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.
23 *
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,
27 * MA 02111-1307, USA.
28 */
29
30/*----- Revision history --------------------------------------------------*
31 *
32 * $Log: env.h,v $
33 * Revision 1.1 1999/07/26 23:15:57 mdw
34 * Fiddling with environment variables.
35 *
36 */
37
38#ifndef ENV_H
39#define ENV_H
40
41#ifdef __cplusplus
42 extern "C" {
43#endif
44
45/*----- Header files ------------------------------------------------------*/
46
47#ifndef SYM_H
48# include "sym.h"
49#endif
50
51/*----- Functions provided ------------------------------------------------*/
52
53/* --- @env_get@ --- *
54 *
55 * Arguments: @sym_table *t@ = pointer to a symbol table
56 * @const char *name@ = pointer to variable name to look up
57 *
58 * Returns: Pointer to corresponding value string, or null.
59 *
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
62 * returned.
63 */
64
65extern char *env_get(sym_table */*t*/, const char */*name*/);
66
67/* --- @env_put@ --- *
68 *
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
72 *
73 * Returns: ---
74 *
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
81 * way you'd expect.
82 */
83
84extern void env_put(sym_table */*t*/,
85 const char */*name*/, const char */*value*/);
86
87/* --- @env_import@ --- *
88 *
89 * Arguments: @sym_table *t@ = pointer to a symbol table
90 * @char **env@ = pointer to an environment list
91 *
92 * Returns: ---
93 *
94 * Use: Inserts all of the environment variables listed into a symbol
95 * table for rapid access. Equivalent to a lot of calls to
96 * @env_put@.
97 */
98
99extern void env_import(sym_table */*t*/, char **/*env*/);
100
101/* --- @env_export@ --- *
102 *
103 * Arguments: @sym_table *t@ = pointer to a symbol table
104 *
105 * Returns: A big environment list.
106 *
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.
110 */
111
112extern char **env_export(sym_table */*t*/);
113
114/* --- @env_destroy@ --- *
115 *
116 * Arguments: @sym_table *t@ = pointer to symbol table
117 *
118 * Returns: ---
119 *
120 * Use: Destroys all the variables in the symbol table.
121 */
122
123extern void env_destroy(sym_table */*t*/);
124
125/*----- That's all, folks -------------------------------------------------*/
126
127#ifdef __cplusplus
128 }
129#endif
130
131#endif