[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RP] Displaying output of commands in the bar
From: |
Shawn Betts |
Subject: |
Re: [RP] Displaying output of commands in the bar |
Date: |
Tue May 20 01:36:07 2003 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Benno <address@hidden> writes:
> This one time, at band camp, Bj?rn Lindstr?m wrote:
> >Isn't that patch redundant? You can already do stuff like this:
> >
> >bind a exec ratpoison -c "echo `command`"
> >
> >If you want to control stdin/sterr you can put a pipe within the
> >backticks. What else could you wish for?
>
> Well, I did note that is could be done otherwise, however that
> seems to be an awful lot of overhead there. Forking another
> copy of ratpoison, then the IPC to transfer it back to ratpoison.
We're not talking about a lot of data here, though. The most text I
can see being echoed woudn't be more than, say, 10 lines. Not more
than a paragraph. It's not like you're echoing a book or something.
Not to mention (presumably) popen forks a copy of ratpoison too. And
there's IPC to transfer it to rp if you run popen. Using /bin/sh you'd
have 2 more IPC transfers (from the command to sh, then from sh to X,
from X to ratpoison).
What about this:
char *
cmd_echo_exec (int interactive, char *data)
{
struct sbuf *s;
if (data == NULL)
{
message (" echo_exec: one argument required ");
return NULL;
}
s = sbuf_new (0);
sbuf_printf (s, "%s -c \"echo $(%s)\"", myargv[0], data);
spawn (sbuf_get (s));
sbuf_free (s);
return NULL;
}
Just a silly wrapper around /bin/sh :).
Shawn