diff options
author | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-26 21:01:37 +0200 |
---|---|---|
committer | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-28 23:50:44 +0200 |
commit | e48a16ce5ec0719f9f119ad5fb5891081e5e6dcd (patch) | |
tree | 2c8b529583f90da684927d38b76d850fca11da4c | |
parent | 3ba33321de0790d60dc473acee093de5a3650480 (diff) | |
download | sway-e48a16ce5ec0719f9f119ad5fb5891081e5e6dcd.tar.xz |
sway: Print usage and exit on unknown options
-rw-r--r-- | sway/main.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/main.c b/sway/main.c index 60a41923..7b24d405 100644 --- a/sway/main.c +++ b/sway/main.c @@ -65,6 +65,18 @@ int main(int argc, char **argv) { }; char *config_path = NULL; + + const char* usage = + "Usage: sway [options] [command]\n" + "\n" + " -c, --config <config> Specify a config file.\n" + " -C, --validate Check the validity of the config file, then exit.\n" + " -d, --debug Enables full logging, including debug information.\n" + " -v, --version Show the version number and quit.\n" + " -V, --verbose Enables more verbose logging.\n" + " --get-socketpath Gets the IPC socket path and prints it, then exits.\n" + "\n"; + int c; while (1) { int option_index = 0; @@ -104,6 +116,9 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } break; + default: + fprintf(stderr, "%s", usage); + exit(EXIT_FAILURE); } } |