Add usage(). Document -n flag. Do not touch/remove /etc/wall_cmos_clock

when -n (do nothing) is used.
This commit is contained in:
Philippe Charnier 1997-10-27 07:49:47 +00:00
parent 77cbf0b31b
commit 342afc34d7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30763
2 changed files with 34 additions and 15 deletions

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: tzsetup.8,v 1.6 1997/02/22 16:14:05 peter Exp $
.\" $Id: tzsetup.8,v 1.7 1997/06/23 04:52:11 steve Exp $
.Dd January 24, 1996
.Dt TZSETUP 8
@ -32,12 +32,22 @@
.Nm tzsetup
.Nd set local timezone
.Sh DESCRIPTION
.Sh SYNOPSIS
.Nm tzsetup
.Op Fl n
.Sh DESCRIPTION
.Nm Tzsetup
is a menu based program to set your local time zone. Pick the continent
and a city (e.g. your capital) that best describes your location and
.Nm tzsetup
.Nm
do all the work for you.
.Pp
The following option is available:
.Bl -tag -width indent
.It Fl n
Do not really do anything.
.El
.Sh BUGS
You need to reboot the machine for changes to take effect.
@ -49,7 +59,8 @@ current time zone file
.It Pa /usr/share/zoneinfo
directory for zoneinfo files
.It Pa /etc/wall_cmos_clock
see adjkerntz(8).
see
.Xr adjkerntz 8 .
.El
.Sh SEE ALSO

View File

@ -25,8 +25,6 @@
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*/
/*
@ -34,6 +32,11 @@
* files provided in newer tzdata releases.
*/
#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
#include <dialog.h>
#include <err.h>
@ -618,6 +621,13 @@ set_zone_whole_country(dialogMenuItem *dmi)
return rv;
}
static void
usage()
{
fprintf(stderr, "usage: tzsetup [-n]\n");
exit(1);
}
int
main(int argc, char **argv)
{
@ -630,16 +640,12 @@ main(int argc, char **argv)
break;
default:
fprintf(stderr, "%s: usage:\n\t%s [-n]\n", argv[0],
argv[0]);
exit(1);
usage();
}
}
if (optind != argc) {
fprintf(stderr, "%s: usage:\n\t%s [-n]\n", argv[0], argv[0]);
exit(1);
}
if (optind != argc)
usage();
read_iso3166_table();
read_zones();
@ -650,9 +656,11 @@ main(int argc, char **argv)
if (!dialog_yesno("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"
"please choose NO here!", 7, 72))
system("rm -f /etc/wall_cmos_clock");
if (reallydoit)
system("rm -f /etc/wall_cmos_clock");
else
system("touch /etc/wall_cmos_clock");
if (reallydoit)
system("touch /etc/wall_cmos_clock");
dialog_clear_norefresh();
dialog_menu("Time Zone Selector", "Select a region", -1, -1,
NCONTINENTS, -NCONTINENTS, continents, 0, NULL, NULL);