Skip to content

Commit

Permalink
compton -h should quit after printing help
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
  • Loading branch information
yshui committed Jan 29, 2019
1 parent 83eff25 commit 9d64dec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <xcb/render.h> // for xcb_render_fixed_t, XXX
#include <xcb/render.h> // for xcb_render_fixed_t, XXX

#include "common.h"
#include "config.h"
Expand All @@ -20,7 +20,7 @@
#pragma GCC diagnostic error "-Wunused-parameter"

/**
* Print usage text and exit.
* Print usage text.
*/
static void usage(int ret) {
#define WARNING_DISABLED " (DISABLED AT COMPILE TIME)"
Expand Down Expand Up @@ -479,25 +479,27 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all
// arguments
optind = 1;
*config_file = NULL;
*exit_code = 0;
while (-1 != (o = getopt_long(argc, argv, shortopts, longopts, &longopt_idx))) {
if (o == 256) {
*config_file = strdup(optarg);
} else if (o == 'h') {
usage(0);
return true;
} else if (o == 'd') {
log_warn("-d will be ignored, please use the DISPLAY "
"environment variable");
} else if (o == 314) {
*all_xerrors = true;
} else if (o == 318) {
printf("%s\n", COMPTON_VERSION);
*exit_code = 0;
return true;
} else if (o == 'S') {
log_warn("-S will be ignored");
} else if (o == 320) {
log_warn("--no-name-pixmap will be ignored");
} else if (o == '?' || o == ':') {
usage(1);
*exit_code = 1;
return true;
}
}
Expand Down

0 comments on commit 9d64dec

Please sign in to comment.