[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] crude patch to pass windowids from cmd_exec
From: |
eichin-ratp |
Subject: |
[RP] crude patch to pass windowids from cmd_exec |
Date: |
Tue Sep 4 11:00:01 2001 |
This crude patch substitutes the decimal windowid into the first
occurance of & in a cmd_exec string. There are other ways of doing
this, possibly better [hmm, just occurred to me: any reason cmd_exec
doesn't just set $WINDOWID for the child? perhaps I'll try patching
that together too] but my main goal is to have a convenient way to
call out to "xwit" (a fine companion to ratpoison) and have it know
the "current" window. _Mark_
Index: actions.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/actions.c,v
retrieving revision 1.73
diff -u -r1.73 actions.c
--- actions.c 2001/09/04 07:24:39 1.73
+++ actions.c 2001/09/04 17:54:18
@@ -790,7 +790,7 @@
char *
cmd_exec (int interactive, void *data)
{
- char *cmd;
+ char *cmd, *subst;
if (data == NULL)
cmd = get_input (MESSAGE_PROMPT_SHELL_COMMAND);
@@ -800,6 +800,15 @@
/* User aborted. */
if (cmd == NULL)
return NULL;
+
+ if ((subst = strchr (cmd, '&'))) {
+ char *cmd2 = xmalloc(strlen(cmd) + 3*sizeof(current_window()->w) + 1);
+ strncpy (cmd2, cmd, (subst - cmd));
+ sprintf (cmd2 + (subst - cmd), "%ld", current_window()->w);
+ strcat (cmd2, subst + 1); /* skip the replaced & */
+ free (cmd);
+ cmd = cmd2;
+ }
spawn (cmd);
- [RP] crude patch to pass windowids from cmd_exec,
eichin-ratp <=