`compton -h` should quit after printing help
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
83eff258b7
commit
9d64decf2a
|
@ -8,7 +8,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.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 "common.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
#pragma GCC diagnostic error "-Wunused-parameter"
|
#pragma GCC diagnostic error "-Wunused-parameter"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print usage text and exit.
|
* Print usage text.
|
||||||
*/
|
*/
|
||||||
static void usage(int ret) {
|
static void usage(int ret) {
|
||||||
#define WARNING_DISABLED " (DISABLED AT COMPILE TIME)"
|
#define WARNING_DISABLED " (DISABLED AT COMPILE TIME)"
|
||||||
|
@ -479,9 +479,13 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all
|
||||||
// arguments
|
// arguments
|
||||||
optind = 1;
|
optind = 1;
|
||||||
*config_file = NULL;
|
*config_file = NULL;
|
||||||
|
*exit_code = 0;
|
||||||
while (-1 != (o = getopt_long(argc, argv, shortopts, longopts, &longopt_idx))) {
|
while (-1 != (o = getopt_long(argc, argv, shortopts, longopts, &longopt_idx))) {
|
||||||
if (o == 256) {
|
if (o == 256) {
|
||||||
*config_file = strdup(optarg);
|
*config_file = strdup(optarg);
|
||||||
|
} else if (o == 'h') {
|
||||||
|
usage(0);
|
||||||
|
return true;
|
||||||
} else if (o == 'd') {
|
} else if (o == 'd') {
|
||||||
log_warn("-d will be ignored, please use the DISPLAY "
|
log_warn("-d will be ignored, please use the DISPLAY "
|
||||||
"environment variable");
|
"environment variable");
|
||||||
|
@ -489,7 +493,6 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all
|
||||||
*all_xerrors = true;
|
*all_xerrors = true;
|
||||||
} else if (o == 318) {
|
} else if (o == 318) {
|
||||||
printf("%s\n", COMPTON_VERSION);
|
printf("%s\n", COMPTON_VERSION);
|
||||||
*exit_code = 0;
|
|
||||||
return true;
|
return true;
|
||||||
} else if (o == 'S') {
|
} else if (o == 'S') {
|
||||||
log_warn("-S will be ignored");
|
log_warn("-S will be ignored");
|
||||||
|
@ -497,7 +500,6 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all
|
||||||
log_warn("--no-name-pixmap will be ignored");
|
log_warn("--no-name-pixmap will be ignored");
|
||||||
} else if (o == '?' || o == ':') {
|
} else if (o == '?' || o == ':') {
|
||||||
usage(1);
|
usage(1);
|
||||||
*exit_code = 1;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue