From cf7ad617d4ce46c6bac6ac28e5323ab53e3ef17b Mon Sep 17 00:00:00 2001 From: sabetts Date: Tue, 18 Nov 2003 05:06:35 +0000 Subject: * contrib/rpshowall.sh: store ratpoison binary location in RATPOISON env var. * src/ratpoison.h (FD_CLOEXEC): new define (set_close_on_exec): new prototype * src/main.c (ratpoison_longopts): add "interactive" option. (ratpoison_opts): likewise (print_help): print a help line for interactive option. (set_close_on_exec): new function (read_startup_files): call set_close_on_exec on file pointer (main): parse interactive command line option and pass it to send_command. * src/events.c (execute_remote_command): pass the interactive bit to command. * src/communications.c (send_command): send an interactive bit at the beginning of the message. Take an interactive argument. All callers updated. Prototype updated. * src/actions.c (cmd_source): call set_close_on_exec on file pointer. --- src/communications.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/communications.c') diff --git a/src/communications.c b/src/communications.c index 4e4e509..352a7ef 100644 --- a/src/communications.c +++ b/src/communications.c @@ -81,10 +81,15 @@ recieve_command_result (Window w) } int -send_command (unsigned char *cmd, int screen_num) +send_command (unsigned char interactive, unsigned char *cmd, int screen_num) { Window w; int done = 0; + struct sbuf *s; + + s = sbuf_new(0); + sbuf_printf(s, "%c%s", interactive, cmd); + /* If the user specified a specific screen, then send the event to that screen. */ @@ -103,12 +108,14 @@ send_command (unsigned char *cmd, int screen_num) XSelectInput (dpy, w, PropertyChangeMask); XChangeProperty (dpy, w, rp_command, XA_STRING, - 8, PropModeReplace, cmd, strlen (cmd) + 1); + 8, PropModeReplace, sbuf_get(s), strlen (cmd) + 2); XChangeProperty (dpy, DefaultRootWindow (dpy), rp_command_request, XA_WINDOW, 8, PropModeAppend, (unsigned char *)&w, sizeof (Window)); + sbuf_free (s); + while (!done) { XEvent ev; -- cgit v1.2.3