commit 5e5fc6da22d1a496e21a52941af91f85b58186d2
parent 5f514c5284b3db94ecb4db1fea1e387d66ed4651
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 28 Jul 2014 14:55:17 +0000
add usage information
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
Diffstat:
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/xscreenshot.c b/xscreenshot.c
@@ -93,6 +93,14 @@ pngstdout(XImage *img)
png_destroy_write_struct(&png_struct_p, NULL);
}
+static void
+usage(void)
+{
+ die("xscreenshot-" VERSION
+ ", (c) 2014 xscreenshot engineers, see LICENSE for details\n"
+ "usage: xscreenshot [winid]");
+}
+
int
main(int argc, char *argv[])
{
@@ -107,10 +115,12 @@ main(int argc, char *argv[])
/* win */
if(argc > 1) {
+ if(strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "-v") == 0)
+ usage();
errno = 0;
win = (Window)strtol(argv[1], NULL, 0);
if(errno != 0)
- die("input not a number");
+ usage();
} else {
win = RootWindow(dpy, 0);
}