summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-02-22 19:08:11 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-02-22 19:21:35 +0100
commitc58386717db86dc7f5e954d2c972c8d606044bb1 (patch)
tree2a82ac0b04e9871ca019059d58214f29183118de /src/main.c
parentf42b5f6fcb244d9b5ad159113cd921c7f69d6134 (diff)
downloadratpoison-c58386717db86dc7f5e954d2c972c8d606044bb1.zip
make ratpoison -c provide a useful exit status
* properly define the way the wm may give feedback to ratpoison -c; see communications.c:receive_command_result() * follow this protocol in events.c:receive_command() * modify receive_command_result() to return an int (which is the mirror of the struct cmdret "success" member used on the wm side) * pass that error status back to main.c; exit with an error status if any of the commands we sent failed
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index ce90847..44cb2e3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -680,21 +680,20 @@ main (int argc, char *argv[])
if (cmd_count > 0)
{
- int j;
+ int j, screen, exit_status = EXIT_SUCCESS;
- for (j=0; j<cmd_count; j++)
- {
- if (screen_arg)
- send_command (interactive, (unsigned char *)cmd[j], screen_num);
- else
- send_command (interactive, (unsigned char *)cmd[j], -1);
+ screen = screen_arg ? screen_num : -1;
+ for (j = 0; j < cmd_count; j++)
+ {
+ if (!send_command (interactive, (unsigned char *)cmd[j], screen))
+ exit_status = EXIT_FAILURE;
free (cmd[j]);
}
free (cmd);
XCloseDisplay (dpy);
- return EXIT_SUCCESS;
+ return exit_status;
}
/* Set our Atoms */