Commit 31e7e1d7bf1b7919d7d0a4bd5b1c7ed040b46bf1 Parent: 6e2474370330555234037bfa66ec81e77df994fe Author: mcol <mcol@posteo.net> Date: 2020-11-23 22:01:45 +0000 Committer: mcol <mcol@posteo.net> Committed: 2020-11-23 22:01:45 +0000 add help message
src/deskwm.c Modified
@@ -16,22 +16,35 @@ #include "types.h" +static const char usage[] = + "usage: deskwm [options...]\n" + " -h show this help message\n" + " -c <file> specify config file\n" + " -d set logging to debug mode\n" + " -i set logging to info mode\n" +; + + int main(int argc, char *argv[]) { wlr_log_init(WLR_ERROR, NULL); int opt; char *config = NULL; - while ((opt = getopt(argc, argv, "dic:")) != -1) { + while ((opt = getopt(argc, argv, "hcdi:")) != -1) { switch (opt) { + case 'h': + printf(usage); + return EXIT_SUCCESS; + break; + case 'c': + config = strdup(optarg); + break; case 'd': wlr_log_init(WLR_DEBUG, NULL); break; case 'i': wlr_log_init(WLR_INFO, NULL); break; - case 'c': - config = strdup(optarg); - break; } }