[BusyBox-cvs] busybox/util-linux hwclock.c,1.11,1.12

Robert Griebl sandman at busybox.net
Mon Mar 22 21:27:42 UTC 2004


Update of /var/cvs/busybox/util-linux
In directory nail:/tmp/cvs-serv6950

Modified Files:
	hwclock.c 
Log Message:
Some corrections from vodz:
- Make -u/-l mutually exclusive
- Minor size reduction


Index: hwclock.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/hwclock.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- a/hwclock.c	21 Mar 2004 18:01:46 -0000	1.11
+++ b/hwclock.c	22 Mar 2004 21:27:39 -0000	1.12
@@ -191,7 +191,7 @@
 extern int hwclock_main ( int argc, char **argv )
 {
 	unsigned long opt;
-	int utc = 0;
+	int utc;
 
 #ifdef CONFIG_FEATURE_HWCLOCK_LONGOPTIONS
 static const struct option hwclock_long_options[] = {
@@ -205,23 +205,18 @@
 	bb_applet_long_options = hwclock_long_options;
 #endif
 
-	bb_opt_complementaly = "r~ws:w~rs:s~wr";
+	bb_opt_complementaly = "r~ws:w~rs:s~wr:l~u:u~l";
 	opt = bb_getopt_ulflags(argc, argv, "lursw");
 	/* Check only one mode was given */
 	if(opt & 0x80000000UL) {
 		bb_show_usage();
 	}
 
-	/* If -u or -l wasnt give check if we are using utc */
-	if (opt & HWCLOCK_OPT_UTC) {
-		utc = 1;
-	}
-	else if (opt & HWCLOCK_OPT_LOCALTIME) {
-		utc = 0;
-	}
-	else {
+	/* If -u or -l wasn't given check if we are using utc */
+	if (opt & (HWCLOCK_OPT_UTC | HWCLOCK_OPT_LOCALTIME)) 
+		utc = opt & HWCLOCK_OPT_UTC;
+	else
 		utc = check_utc();
-	}
 	
 	if (opt & HWCLOCK_OPT_HCTOSYS) {
 		return to_sys_clock ( utc );




More information about the busybox-cvs mailing list