Back to index

glibc  2.9
envz.h
Go to the documentation of this file.
00001 /* Routines for dealing with '\0' separated environment vectors
00002    Copyright (C) 1995, 96, 98, 99, 2000 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _ENVZ_H
00021 #define _ENVZ_H      1
00022 
00023 #include <features.h>
00024 
00025 #include <errno.h>
00026 
00027 /* Envz's are argz's too, and should be created etc., using the same
00028    routines.  */
00029 #include <argz.h>
00030 
00031 __BEGIN_DECLS
00032 
00033 /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none.  */
00034 extern char *envz_entry (__const char *__restrict __envz, size_t __envz_len,
00035                       __const char *__restrict __name)
00036      __THROW __attribute_pure__;
00037 
00038 /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0
00039    if there is none.  */
00040 extern char *envz_get (__const char *__restrict __envz, size_t __envz_len,
00041                      __const char *__restrict __name)
00042      __THROW __attribute_pure__;
00043 
00044 /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN.  If an entry
00045    with the same name already exists in ENVZ, it is removed.  If VALUE is
00046    NULL, then the new entry will a special null one, for which envz_get will
00047    return NULL, although envz_entry will still return an entry; this is handy
00048    because when merging with another envz, the null entry can override an
00049    entry in the other one.  Null entries can be removed with envz_strip ().  */
00050 extern error_t envz_add (char **__restrict __envz,
00051                       size_t *__restrict __envz_len,
00052                       __const char *__restrict __name,
00053                       __const char *__restrict __value) __THROW;
00054 
00055 /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add().  If
00056    OVERRIDE is true, then values in ENVZ2 will supersede those with the same
00057    name in ENV, otherwise not.  */
00058 extern error_t envz_merge (char **__restrict __envz,
00059                         size_t *__restrict __envz_len,
00060                         __const char *__restrict __envz2,
00061                         size_t __envz2_len, int __override) __THROW;
00062 
00063 /* Remove the entry for NAME from ENVZ & ENVZ_LEN, if any.  */
00064 extern void envz_remove (char **__restrict __envz,
00065                       size_t *__restrict __envz_len,
00066                       __const char *__restrict __name) __THROW;
00067 
00068 /* Remove null entries.  */
00069 extern void envz_strip (char **__restrict __envz,
00070                      size_t *__restrict __envz_len) __THROW;
00071 
00072 __END_DECLS
00073 
00074 #endif /* envz.h */