Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Sep 2009 08:46:26 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r196914 - stable/7/usr.sbin/tzsetup
Message-ID:  <200909070846.n878kQLe008508@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Mon Sep  7 08:46:26 2009
New Revision: 196914
URL: http://svn.freebsd.org/changeset/base/196914

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/7/usr.sbin/tzsetup/tzsetup.8
  stable/7/usr.sbin/tzsetup/tzsetup.c

Modified: stable/7/usr.sbin/tzsetup/tzsetup.8
==============================================================================
--- stable/7/usr.sbin/tzsetup/tzsetup.8	Mon Sep  7 08:41:14 2009	(r196913)
+++ stable/7/usr.sbin/tzsetup/tzsetup.8	Mon Sep  7 08:46:26 2009	(r196914)
@@ -23,7 +23,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd January 24, 1996
+.Dd September 05, 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/7/usr.sbin/tzsetup/tzsetup.c
==============================================================================
--- stable/7/usr.sbin/tzsetup/tzsetup.c	Mon Sep  7 08:41:14 2009	(r196913)
+++ stable/7/usr.sbin/tzsetup/tzsetup.c	Mon Sep  7 08:46:26 2009	(r196914)
@@ -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]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909070846.n878kQLe008508>