aboutsummaryrefslogtreecommitdiff
path: root/swaymsg
diff options
context:
space:
mode:
authorChristoph Gysin <christoph.gysin@gmail.com>2015-11-28 16:09:19 +0200
committerChristoph Gysin <christoph.gysin@gmail.com>2015-11-28 23:50:44 +0200
commit0d55d1a0676704acdab86da231fe16d7e61c4ccf (patch)
tree7c70cfd8b18664ea294a865f69ec5a63484f1129 /swaymsg
parentb235ccd212920db7e444716b7a36fcb4a36a3644 (diff)
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) {
{0, 0, 0, 0}
};
+ const char *usage =
+ "Usage: swaymsg [options] [message]\n"
+ "\n"
+ " -q, --quiet Be quiet.\n"
+ " -v, --version Show the version number and quit.\n"
+ " -s, --socket <socket> Use the specified socket.\n"
+ " -t, --type <type> Specify the message type.\n";
+
int c;
while (1) {
int option_index = 0;
@@ -54,6 +62,9 @@ int main(int argc, char **argv) {
#endif
exit(EXIT_SUCCESS);
break;
+ default:
+ fprintf(stderr, "%s", usage);
+ exit(EXIT_FAILURE);
}
}