From 39193ce4f0d99ad8f16707e00590cb0831c3b2ea Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 28 Nov 2007 16:35:52 +0000 Subject: Add a "restart wm" function. ok oga@ --- util.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'util.c') 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 * 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; -- cgit v1.2.3-2-gb3c3