summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authoralgernon <algernon>2002-01-08 19:14:00 +0000
committeralgernon <algernon>2002-01-08 19:14:00 +0000
commitc3a3bcb206bd339d8d40d47d3f5d97040db0d46e (patch)
treee87139687eaac902c4e0bbcac77bd695f40bc4c2 /src/actions.c
parent702850ec75adbd43d79c480960a30d336894620a (diff)
downloadratpoison-c3a3bcb206bd339d8d40d47d3f5d97040db0d46e.zip
(setenv, unsetenv): new functions, used when the system libc does not have them.
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c
index 6adb8cf..4553ecc 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1980,6 +1980,46 @@ cmd_defbgcolor (int interactive, void *data)
return NULL;
}
+#ifndef HAVE_SETENV
+/* For systems, such as Solaris, where setenv is not implemented
+ * in libc */
+/* FIXME: overwrite has no effect in this implementation! */
+int
+setenv (const char *name, const char *value, int overwrite)
+{
+ char *tmp;
+ int i;
+
+ tmp = (char *)malloc (strlen(name) + strlen(value) + 2);
+ strcpy(tmp, name);
+ strcat(tmp, "=");
+ strcat(tmp, value);
+
+ i = putenv(tmp);
+
+ free(tmp);
+
+ return i;
+}
+#endif
+
+#ifndef HAVE_UNSETENV
+/* For systems which lack unsetenv (eg, Solaris) */
+void
+unsetenv (const char *name)
+{
+ char *tmp;
+
+ tmp = (char *)malloc (strlen(name) + 2);
+ strcpy (tmp, name);
+ strcat (tmp, "=");
+
+ putenv(tmp);
+
+ free(tmp);
+}
+#endif
+
char *
cmd_setenv (int interactive, void *data)
{