svn commit: r196972 - stable/6/usr.sbin/tzsetup

Attilio Rao attilio at FreeBSD.org
Tue Sep 8 14:15:15 UTC 2009


Author: attilio
Date: Tue Sep  8 14:15:14 2009
New Revision: 196972
URL: http://svn.freebsd.org/changeset/base/196972

Log:
  MFC r195339:
  Add a new option (-s) that, when specified, skips the question about
  adjusting the clock to UTC.
  
  Sponsored by: Sandvine Incorporated

Modified:
  stable/6/usr.sbin/tzsetup/tzsetup.8
  stable/6/usr.sbin/tzsetup/tzsetup.c

Modified: stable/6/usr.sbin/tzsetup/tzsetup.8
==============================================================================
--- stable/6/usr.sbin/tzsetup/tzsetup.8	Tue Sep  8 13:24:36 2009	(r196971)
+++ stable/6/usr.sbin/tzsetup/tzsetup.8	Tue Sep  8 14:15:14 2009	(r196972)
@@ -23,7 +23,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd January 24, 1996
+.Dd September 08, 2009
 .Dt TZSETUP 8
 .Os
 .Sh NAME
@@ -31,7 +31,7 @@
 .Nd set local timezone
 .Sh SYNOPSIS
 .Nm
-.Op Fl n
+.Op Fl ns
 .Op Ar default
 .Sh DESCRIPTION
 The
@@ -51,6 +51,9 @@ The following option is available:
 .Bl -tag -offset indent -width Fl
 .It Fl n
 Do not create or copy files.
+.It Fl s
+Skip the initial question about adjusting the clock if not set to
+.Tn UTC .
 .El
 .Pp
 It is possible to short-circuit the menu system by specifying a

Modified: stable/6/usr.sbin/tzsetup/tzsetup.c
==============================================================================
--- stable/6/usr.sbin/tzsetup/tzsetup.c	Tue Sep  8 13:24:36 2009	(r196971)
+++ stable/6/usr.sbin/tzsetup/tzsetup.c	Tue Sep  8 14:15:14 2009	(r196972)
@@ -648,11 +648,14 @@ main(int argc, char **argv)
 	dialog_utc = dialog_noyes;
 #endif
 
-	while ((c = getopt(argc, argv, "n")) != -1) {
+	while ((c = getopt(argc, argv, "ns")) != -1) {
 		switch(c) {
 		case 'n':
 			reallydoit = 0;
 			break;
+		case 's':
+			dialog_utc = NULL;
+			break;
 
 		default:
 			usage();
@@ -671,22 +674,25 @@ main(int argc, char **argv)
 	make_menus();
 
 	init_dialog();
-	if (!dialog_utc("Select local or UTC (Greenwich Mean Time) clock",
-			"Is this machine's CMOS clock set to UTC?  If it is set to local time,\n"
-			"or you don't know, please choose NO here!", 7, 72)) {
-		if (reallydoit)
-			unlink(_PATH_WALL_CMOS_CLOCK);
-	} else {
-		if (reallydoit) {
-			fd = open(_PATH_WALL_CMOS_CLOCK,
-				  O_WRONLY|O_CREAT|O_TRUNC,
-				  S_IRUSR|S_IRGRP|S_IROTH);
-			if (fd < 0)
-				err(1, "create %s", _PATH_WALL_CMOS_CLOCK);
-			close(fd);
+	if (dialog_utc != NULL) {
+		if (!dialog_utc("Select local or UTC (Greenwich Mean Time) clock",
+		    "Is this machine's CMOS clock set to UTC?  If it is set to local time,\n"
+		    "or you don't know, please choose NO here!", 7, 72)) {
+			if (reallydoit)
+				unlink(_PATH_WALL_CMOS_CLOCK);
+		} else {
+			if (reallydoit) {
+				fd = open(_PATH_WALL_CMOS_CLOCK,
+				    O_WRONLY|O_CREAT|O_TRUNC,
+				    S_IRUSR|S_IRGRP|S_IROTH);
+				if (fd < 0)
+					err(1, "create %s",
+					    _PATH_WALL_CMOS_CLOCK);
+				close(fd);
+			}
 		}
+		dialog_clear_norefresh();
 	}
-	dialog_clear_norefresh();
 	if (optind == argc - 1) {
 		char *msg;
 		asprintf(&msg, "\nUse the default `%s' zone?", argv[optind]);


More information about the svn-src-stable-6 mailing list