47 for (
char **p = *envp; p && *p; p++)
66 for (src = envp; src && *src; src++)
70 for (src = envp, dst = env_copy; src && *src; src++, dst++)
88bool envlist_set(
char ***envp,
const char *name,
const char *value,
bool overwrite)
90 if (!envp || !*envp || !name || (name[0] ==
'\0'))
97 for (; (str = (*envp)[count]); count++)
100 if ((len != 0) && (str[len] ==
'='))
110 char work[1024] = { 0 };
111 snprintf(work,
sizeof(work),
"%s=%s", name,
NONULL(value));
123 (*envp)[count + 1] = NULL;
138 if (!envp || !*envp || !name || (name[0] ==
'\0'))
142 for (; (*envp)[count]; count++)
146 for (
int match = 0; (str = (*envp)[match]); match++)
149 if ((len != 0) && (str[len] ==
'='))
151 FREE(&(*envp)[match]);
153 memmove(&(*envp)[match], &(*envp)[match + 1], (count - match) *
sizeof(
char *));
void envlist_free(char ***envp)
Free the private copy of the environment.
char ** envlist_init(char **envp)
Create a copy of the environment.
bool envlist_set(char ***envp, const char *name, const char *value, bool overwrite)
Set an environment variable.
bool envlist_unset(char ***envp, const char *name)
Unset an environment variable.
Private copy of the environment variables.
Memory management wrappers.
#define MUTT_MEM_CALLOC(n, type)
#define MUTT_MEM_REALLOC(pptr, n, type)
char * mutt_str_dup(const char *str)
Copy a string, safely.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
String manipulation functions.