Blame string/envz.h

Packit 6c4009
/* Routines for dealing with '\0' separated environment vectors
Packit 6c4009
   Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _ENVZ_H
Packit 6c4009
#define _ENVZ_H	1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
Packit 6c4009
#include <errno.h>
Packit 6c4009
Packit 6c4009
/* Envz's are argz's too, and should be created etc., using the same
Packit 6c4009
   routines.  */
Packit 6c4009
#include <argz.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
/* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none.  */
Packit 6c4009
extern char *envz_entry (const char *__restrict __envz, size_t __envz_len,
Packit 6c4009
			 const char *__restrict __name)
Packit 6c4009
     __THROW __attribute_pure__;
Packit 6c4009
Packit 6c4009
/* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0
Packit 6c4009
   if there is none.  */
Packit 6c4009
extern char *envz_get (const char *__restrict __envz, size_t __envz_len,
Packit 6c4009
		       const char *__restrict __name)
Packit 6c4009
     __THROW __attribute_pure__;
Packit 6c4009
Packit 6c4009
/* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN.  If an entry
Packit 6c4009
   with the same name already exists in ENVZ, it is removed.  If VALUE is
Packit 6c4009
   NULL, then the new entry will a special null one, for which envz_get will
Packit 6c4009
   return NULL, although envz_entry will still return an entry; this is handy
Packit 6c4009
   because when merging with another envz, the null entry can override an
Packit 6c4009
   entry in the other one.  Null entries can be removed with envz_strip ().  */
Packit 6c4009
extern error_t envz_add (char **__restrict __envz,
Packit 6c4009
			 size_t *__restrict __envz_len,
Packit 6c4009
			 const char *__restrict __name,
Packit 6c4009
			 const char *__restrict __value) __THROW;
Packit 6c4009
Packit 6c4009
/* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add().  If
Packit 6c4009
   OVERRIDE is true, then values in ENVZ2 will supersede those with the same
Packit 6c4009
   name in ENV, otherwise not.  */
Packit 6c4009
extern error_t envz_merge (char **__restrict __envz,
Packit 6c4009
			   size_t *__restrict __envz_len,
Packit 6c4009
			   const char *__restrict __envz2,
Packit 6c4009
			   size_t __envz2_len, int __override) __THROW;
Packit 6c4009
Packit 6c4009
/* Remove the entry for NAME from ENVZ & ENVZ_LEN, if any.  */
Packit 6c4009
extern void envz_remove (char **__restrict __envz,
Packit 6c4009
			 size_t *__restrict __envz_len,
Packit 6c4009
			 const char *__restrict __name) __THROW;
Packit 6c4009
Packit 6c4009
/* Remove null entries.  */
Packit 6c4009
extern void envz_strip (char **__restrict __envz,
Packit 6c4009
			size_t *__restrict __envz_len) __THROW;
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* envz.h */