summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
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 */