summaryrefslogtreecommitdiff
path: root/helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'helper.c')
-rw-r--r--helper.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/helper.c b/helper.c
index 47e797b6c..91a78b577 100644
--- a/helper.c
+++ b/helper.c
@@ -149,3 +149,24 @@ void setproctitle(const char *fmt, ...)
149 /* FIXME */ 149 /* FIXME */
150} 150}
151#endif /* !HAVE_SETPROCTITLE */ 151#endif /* !HAVE_SETPROCTITLE */
152
153#ifndef HAVE_SETENV
154int setenv(const char *name, const char *value, int overwrite)
155{
156 char *env_string;
157 int result;
158
159 /* Don't overwrite existing env. var if overwrite is 0 */
160 if (!overwrite && (getenv(name) != NULL))
161 return(0);
162
163 env_string = xmalloc(strlen(name) + strlen(value) + 2);
164 sprintf(env_string, "%s=%s", name, value);
165
166 result = putenv(env_string);
167
168 xfree(env_string);
169
170 return(result);
171}
172#endif /* !HAVE_SETENV */