[PATCH 08/12] weston-dnd --help works

Bill Spitzak spitzak at gmail.com
Fri Aug 8 12:59:57 PDT 2014


---
 clients/dnd.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/clients/dnd.c b/clients/dnd.c
index 620cfff..cb13697 100644
--- a/clients/dnd.c
+++ b/clients/dnd.c
@@ -652,7 +652,14 @@ main(int argc, char *argv[])
 {
 	struct display *d;
 	struct dnd *dnd;
-	int i;
+	int self_only = 0;
+
+	if (argc == 2 && !strcmp(argv[1], "--self-only"))
+		self_only = 1;
+	else if (argc > 1) {
+		printf("Usage: %s [OPTIONS]\n  --self-only\n", argv[0]);
+		return 1;
+	}
 
 	d = display_create(&argc, argv);
 	if (d == NULL) {
@@ -661,10 +668,7 @@ main(int argc, char *argv[])
 	}
 
 	dnd = dnd_create(d);
-
-	for (i = 1; i < argc; i++)
-		if (strcmp("--self-only", argv[i]) == 0)
-			dnd->self_only = 1;
+	if (self_only) dnd->self_only = 1;
 
 	display_run(d);
 
-- 
1.7.9.5



More information about the wayland-devel mailing list