summaryrefslogtreecommitdiffstats
path: root/swaymsg
diff options
context:
space:
mode:
authorLibravatar Christoph Gysin <christoph.gysin@gmail.com>2015-11-28 16:09:19 +0200
committerLibravatar Christoph Gysin <christoph.gysin@gmail.com>2015-11-28 23:50:44 +0200
commit0d55d1a0676704acdab86da231fe16d7e61c4ccf (patch)
tree7c70cfd8b18664ea294a865f69ec5a63484f1129 /swaymsg
parentswaygrab: Print usage and exit on unknown options (diff)
downloadsway-0d55d1a0676704acdab86da231fe16d7e61c4ccf.tar.gz
sway-0d55d1a0676704acdab86da231fe16d7e61c4ccf.tar.zst
sway-0d55d1a0676704acdab86da231fe16d7e61c4ccf.zip
swaymsg: Print usage and exit on unknown options
Diffstat (limited to 'swaymsg')
-rw-r--r--swaymsg/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c
index e629bcc2..2f2e843a 100644
--- a/swaymsg/main.c
+++ b/swaymsg/main.c
@@ -30,6 +30,14 @@ int main(int argc, char **argv) {
30 {0, 0, 0, 0} 30 {0, 0, 0, 0}
31 }; 31 };
32 32
33 const char *usage =
34 "Usage: swaymsg [options] [message]\n"
35 "\n"
36 " -q, --quiet Be quiet.\n"
37 " -v, --version Show the version number and quit.\n"
38 " -s, --socket <socket> Use the specified socket.\n"
39 " -t, --type <type> Specify the message type.\n";
40
33 int c; 41 int c;
34 while (1) { 42 while (1) {
35 int option_index = 0; 43 int option_index = 0;
@@ -54,6 +62,9 @@ int main(int argc, char **argv) {
54#endif 62#endif
55 exit(EXIT_SUCCESS); 63 exit(EXIT_SUCCESS);
56 break; 64 break;
65 default:
66 fprintf(stderr, "%s", usage);
67 exit(EXIT_FAILURE);
57 } 68 }
58 } 69 }
59 70