[RFC PATCH 2/2] add execr command

Ali Gholami Rudi <[email protected]>
Newsgroups gmane.comp.window-managers.ratpoison.devel
Message-ID <20081119082241.GF4894@lilem>
The execr (short for raw exec) command, executes a program without
forking a sh.
---
 doc/ratpoison.texi |    4 ++++
 src/actions.c      |    9 +++++++++
 src/actions.h      |    1 +
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi
index aa0e3c1..83c5059 100644
--- a/doc/ratpoison.texi
+++ b/doc/ratpoison.texi
@@ -1548,6 +1548,10 @@ window will open in. The client must be netwm compliant for this to
 work.
 @end deffn
 
+@deffn Command execr @var{command}
+Execute a command without forking a shell.
+@end deffn
+
 @deffn Command getenv @var{env}
 Display the value of the environment variable, @var{env}.
 @end deffn
diff --git a/src/actions.c b/src/actions.c
index 12eddd3..777609a 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -229,6 +229,8 @@ init_user_commands(void)
   add_command ("execf",		cmd_execf,	2, 2, 2, 
 	       "frame to execute in:", arg_FRAME,
 	       "/bin/sh -c ", arg_SHELLCMD);
+  add_command ("execr",		cmd_execr,	1, 1, 1,
+               "", arg_SHELLCMD);
   add_command ("fdump",         cmd_fdump,      1, 0, 0,
                "", arg_NUMBER);
   add_command ("focus",         cmd_next_frame, 0, 0, 0);
@@ -2574,6 +2576,13 @@ cmd_execf (int interactive, struct cmdarg **args)
   return cmdret_new (RET_SUCCESS, NULL);
 }
 
+cmdret *
+cmd_execr (int interactive, struct cmdarg **args)
+{
+  spawn (ARG_STRING (0), 1, current_frame());
+  return cmdret_new (RET_SUCCESS, NULL);
+}
+
 #define MAXARGCNT	16
 #define MAXARGLEN	64
 
diff --git a/src/actions.h b/src/actions.h
index 3fcd3b7..d7094ce 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -117,6 +117,7 @@ RP_CMD (escape);
 RP_CMD (exec);
 RP_CMD (execa);
 RP_CMD (execf);
+RP_CMD (execr);
 RP_CMD (fdump);
 RP_CMD (focusdown);
 RP_CMD (focuslast);
-- 
1.6.0.2.GIT
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.