aboutsummaryrefslogtreecommitdiffstats
path: root/swaygrab
diff options
context:
space:
mode:
authorLibravatar Christoph Gysin <christoph.gysin@gmail.com>2015-11-28 16:09:14 +0200
committerLibravatar Christoph Gysin <christoph.gysin@gmail.com>2015-11-28 23:50:44 +0200
commitb235ccd212920db7e444716b7a36fcb4a36a3644 (patch)
tree8061a7ee4e4ad1f3b2bff465df6dc8bab447adea /swaygrab
parentsway: Print usage and exit on unknown options (diff)
downloadsway-b235ccd212920db7e444716b7a36fcb4a36a3644.tar.gz
sway-b235ccd212920db7e444716b7a36fcb4a36a3644.tar.zst
sway-b235ccd212920db7e444716b7a36fcb4a36a3644.zip
swaygrab: Print usage and exit on unknown options
Diffstat (limited to 'swaygrab')
-rw-r--r--swaygrab/main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/swaygrab/main.c b/swaygrab/main.c
index e60d154f..90d118e2 100644
--- a/swaygrab/main.c
+++ b/swaygrab/main.c
@@ -135,6 +135,15 @@ int main(int argc, char **argv) {
135 {0, 0, 0, 0} 135 {0, 0, 0, 0}
136 }; 136 };
137 137
138 const char *usage =
139 "Usage: swaygrab [options] <output> [file]\n"
140 "\n"
141 " -c, --capture Capture video.\n"
142 " -v, --version Show the version number and quit.\n"
143 " -s, --socket <socket> Use the specified socket.\n"
144 " -R, --rate <rate> Specify framerate (default: 30)\n"
145 " -r, --raw Write raw rgba data to stdout.\n";
146
138 int c; 147 int c;
139 while (1) { 148 while (1) {
140 int option_index = 0; 149 int option_index = 0;
@@ -165,6 +174,9 @@ int main(int argc, char **argv) {
165#endif 174#endif
166 exit(EXIT_SUCCESS); 175 exit(EXIT_SUCCESS);
167 break; 176 break;
177 default:
178 fprintf(stderr, "%s", usage);
179 exit(EXIT_FAILURE);
168 } 180 }
169 } 181 }
170 182