env-util.h revision 77ebdd4ea458350c492f042a76a2056e013e69be
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch#ifndef ENV_UTIL_H
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch#define ENV_UTIL_H
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch/* Add new environment variable. Wrapper to putenv(). Note that calls to this
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch function allocates memory which isn't free'd until env_clean() is called. */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid env_put(const char *env);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch/* Clear all environment variables. */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid env_clean(void);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch/* Append a string containing key=value to the array */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid envarr_add(ARRAY_TYPE(const_string) *arr,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch const char *key, const char *value);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid envarr_addi(ARRAY_TYPE(const_string) *arr, const char *key,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch unsigned int value);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch/* Append a string containing key=1 to the array */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid envarr_addb(ARRAY_TYPE(const_string) *arr, const char *key);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch#endif
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch