[PATCH:xset 1/3] Give better error for "xset dpms force" without argument

Alan Coopersmith alan.coopersmith at oracle.com
Fri Jul 15 18:34:19 PDT 2011


Changes from "xset:  unknown option force" to
"xset:  missing argument to dpms force"

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 xset.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/xset.c b/xset.c
index f41dbb5..7703618 100644
--- a/xset.c
+++ b/xset.c
@@ -555,8 +555,9 @@ main(int argc, char *argv[])
 		    DPMSEnable(dpy);
 		    DPMSSetTimeouts(dpy, standby_timeout, suspend_timeout,
 			off_timeout);
-		} else if (i + 1 < argc && strcmp(arg, "force") == 0) {
-		    i++;
+		} else if (strcmp(arg, "force") == 0) {
+		    if (++i >= argc)
+			usage("missing argument to dpms force", NULL);
 		    arg = argv[i];
 		    /*
 		     * The calls to usleep below are necessary to
-- 
1.7.3.2



More information about the xorg-devel mailing list