chiark / gitweb /
Missing argument in sel_addtimer docs.
[mLib] / env.h
CommitLineData
e19206c2 1/* -*-c-*-
2 *
8656dc50 3 * $Id: env.h,v 1.3 2004/04/08 01:36:11 mdw Exp $
e19206c2 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
c6e0eaf0 30#ifndef MLIB_ENV_H
31#define MLIB_ENV_H
e19206c2 32
33#ifdef __cplusplus
34 extern "C" {
35#endif
36
37/*----- Header files ------------------------------------------------------*/
38
c6e0eaf0 39#ifndef MLIB_SYM_H
e19206c2 40# include "sym.h"
41#endif
42
43/*----- Functions provided ------------------------------------------------*/
44
45/* --- @env_get@ --- *
46 *
47 * Arguments: @sym_table *t@ = pointer to a symbol table
48 * @const char *name@ = pointer to variable name to look up
49 *
50 * Returns: Pointer to corresponding value string, or null.
51 *
52 * Use: Looks up an environment variable in the table and returns its
53 * value. If the variable can't be found, a null pointer is
54 * returned.
55 */
56
57extern char *env_get(sym_table */*t*/, const char */*name*/);
58
59/* --- @env_put@ --- *
60 *
61 * Arguments: @sym_table *t@ = pointer to a symbol table
62 * @const char *name@ = pointer to variable name to set
63 * @const char *value@ = pointer to value string to assign
64 *
65 * Returns: ---
66 *
67 * Use: Assigns a value to a variable. If the @name@ contains an
68 * equals character, then it's assumed to be of the form
69 * `VAR=VALUE' and @value@ argument is ignored. Otherwise, if
70 * @value@ is null, the variable is deleted. Finally, the
71 * normal case: @name@ is a plain name, and @value@ is a normal
72 * string causes the variable to be assigned the value in the
73 * way you'd expect.
74 */
75
76extern void env_put(sym_table */*t*/,
77 const char */*name*/, const char */*value*/);
78
79/* --- @env_import@ --- *
80 *
81 * Arguments: @sym_table *t@ = pointer to a symbol table
82 * @char **env@ = pointer to an environment list
83 *
84 * Returns: ---
85 *
86 * Use: Inserts all of the environment variables listed into a symbol
87 * table for rapid access. Equivalent to a lot of calls to
88 * @env_put@.
89 */
90
91extern void env_import(sym_table */*t*/, char **/*env*/);
92
93/* --- @env_export@ --- *
94 *
95 * Arguments: @sym_table *t@ = pointer to a symbol table
96 *
97 * Returns: A big environment list.
98 *
99 * Use: Extracts an environment table from a symbol table
100 * representation of an environment. The table and all of the
101 * strings are in one big block allocated from the heap.
102 */
103
104extern char **env_export(sym_table */*t*/);
105
106/* --- @env_destroy@ --- *
107 *
108 * Arguments: @sym_table *t@ = pointer to symbol table
109 *
110 * Returns: ---
111 *
112 * Use: Destroys all the variables in the symbol table.
113 */
114
115extern void env_destroy(sym_table */*t*/);
116
117/*----- That's all, folks -------------------------------------------------*/
118
119#ifdef __cplusplus
120 }
121#endif
122
123#endif