[hackers] [ubase][PATCH] hwclock: [-rsw] => (-r | -s | -w) and fix flag check

From: Mattias Andrée <maandree_AT_kth.se>
Date: Fri, 22 Apr 2016 03:24:47 +0200

Also in man page: [-r | -s | -w] => (-r | -s | -w)

Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
---
 hwclock.8 | 2 +-
 hwclock.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hwclock.8 b/hwclock.8
index 483c3a4..8e989c2 100644
--- a/hwclock.8
+++ b/hwclock.8
_AT_@ -6,7 +6,7 @@
 .Nd query or set the hardware clock
 .Sh SYNOPSIS
 .Nm
-.Op Fl r | Fl s | Fl w
+.Po Fl r | Fl s | Fl w Pc
 .Op Fl u
 .Op Ar dev
 .Sh DESCRIPTION
diff --git a/hwclock.c b/hwclock.c
index d63a72a..590436a 100644
--- a/hwclock.c
+++ b/hwclock.c
_AT_@ -109,7 +109,7 @@ systohc(char *dev)
 static void
 usage(void)
 {
-	eprintf("usage: %s [-rsw] [-u] [dev]\n", argv0);
+	eprintf("usage: %s (-r | -s | -w) [-u] [dev]\n", argv0);
 }
 
 int
_AT_@ -141,7 +141,7 @@ main(int argc, char *argv[])
 	else if (argc == 1)
 		dev = argv[0];
 
-	if ((rflag ^ sflag ^ wflag) == 0)
+	if (rflag + sflag + wflag != 1)
 		eprintf("missing or incompatible function\n");
 
 	/* Only UTC support at the moment */
_AT_@ -156,4 +156,4 @@ main(int argc, char *argv[])
 		systohc(dev);
 
 	return 0;
-}
\ No newline at end of file
+}
-- 
2.8.0
Received on Fri Apr 22 2016 - 03:24:47 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 22 2016 - 03:36:15 CEST