aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorian2007-11-28 16:35:52 +0000
committerian2007-11-28 16:35:52 +0000
commit39193ce4f0d99ad8f16707e00590cb0831c3b2ea (patch)
tree539855d794aea6a6c341d16825df3c4be2d2d8cf /util.c
parent7f9f575b0ac9765c51c4ac7f61c23660576a5e22 (diff)
downloadcwm-39193ce4f0d99ad8f16707e00590cb0831c3b2ea.tar.gz
Add a "restart wm" function. ok oga@
Diffstat (limited to '')
-rw-r--r--util.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/util.c b/util.c
index 157783a..3b2ddbc 100644
--- a/util.c
+++ b/util.c
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org>
* All rights reserved.
*
- * $Id: util.c,v 1.1.1.1 2007/04/27 17:58:48 bernd Exp $
+ * $Id: util.c,v 1.2 2007/11/28 16:35:52 ian Exp $
*/
#include "headers.h"
@@ -39,6 +39,22 @@ u_spawn(char *argstr)
return (0);
}
+void
+exec_wm(char *argstr)
+{
+ char *args[MAXARGLEN], **ap = args;
+ char **end = &args[MAXARGLEN - 1];
+
+ while (ap < end && (*ap = strsep(&argstr, " \t")) != NULL)
+ ap++;
+
+ *ap = NULL;
+ setsid();
+ execvp(args[0], args);
+ err(1, args[0]);
+}
+
+
int dirent_exists(char *filename) {
struct stat buffer;