summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2004-10-05 20:57:31 +0000
committersabetts <sabetts>2004-10-05 20:57:31 +0000
commita2aeb8461a435621330a692998237f259c356640 (patch)
treefac0c7b51d71fae0f6c1863c03a7bbee9e96e335 /src
parentf4db5f65334718728090283acbb5b99f4895a469 (diff)
downloadratpoison-a2aeb8461a435621330a692998237f259c356640.zip
* src/actions.c (cmd_unsetenv): add an '=' to the string passed to
putenv.
Diffstat (limited to 'src')
-rw-r--r--src/actions.c12
-rw-r--r--src/sbuf.c15
-rw-r--r--src/sbuf.h1
3 files changed, 26 insertions, 2 deletions
diff --git a/src/actions.c b/src/actions.c
index 2f53294..9c97332 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -2753,14 +2753,22 @@ cmd_chdir (int interactive, char *data)
char *
cmd_unsetenv (int interactive, char *data)
{
+ struct sbuf *s;
+ char *str;
+
if (data == NULL)
{
message (" unsetenv: one argument is required ");
return NULL;
}
- /* Remove all instances of the env. var. */
- putenv (data);
+ /* Remove all instances of the env. var. We must add an '=' for it
+ to work on OpenBSD. */
+ s = sbuf_new(0);
+ sbuf_copy (s, data);
+ sbuf_concat (s, "=");
+ str = sbuf_free_struct (s);
+ putenv (str);
return NULL;
}
diff --git a/src/sbuf.c b/src/sbuf.c
index c28eed8..52af83e 100644
--- a/src/sbuf.c
+++ b/src/sbuf.c
@@ -53,6 +53,21 @@ sbuf_free (struct sbuf *b)
}
}
+/* Free the structure but return the string. */
+char *
+sbuf_free_struct (struct sbuf *b)
+{
+ if (b != NULL)
+ {
+ char *tmp;
+ tmp = b->data;
+ free (b);
+ return tmp;
+ }
+
+ return NULL;
+}
+
char *
sbuf_concat (struct sbuf *b, const char *str)
{
diff --git a/src/sbuf.h b/src/sbuf.h
index cd5300f..22fe975 100644
--- a/src/sbuf.h
+++ b/src/sbuf.h
@@ -37,6 +37,7 @@ sbuf
struct sbuf *sbuf_new (size_t initsz);
void sbuf_free (struct sbuf *b);
+char *sbuf_free_struct (struct sbuf *b);
char *sbuf_concat (struct sbuf *b, const char *str);
char *sbuf_copy (struct sbuf *b, const char *str);
char *sbuf_clear (struct sbuf *b);