tzsetup: ask local/UTC question only on x86

Storing local time in the RTC is a legacy of 1990s PCs; it's not
relevant on other platforms of interest to FreeBSD.

While here switch to C99 bool.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	allanjude (earlier), imp (earlier)
Differential Revision: https://reviews.freebsd.org/D45575
This commit is contained in:
Ed Maste 2024-06-12 19:48:24 -04:00
parent 4fd5b8aed8
commit aa6fb1d277
2 changed files with 17 additions and 11 deletions

View file

@ -62,7 +62,8 @@ Skip the initial question about adjusting the clock if not set to UTC.
.Nm
will neither create nor delete
.Pa /etc/wall_cmos_clock .
On a newly installed system the hardware clock will keep UTC.
On a newly installed system, the hardware clock will keep UTC.
This option is enabled automatically on non-x86 hardware.
.El
.Pp
It is possible to short-circuit the menu system by specifying the

View file

@ -826,23 +826,28 @@ main(int argc, char **argv)
char prompt[128];
int fd;
#endif
int c, rv, skiputc;
int c, rv;
bool skiputc;
char *dztpath;
#if defined(__i386__) || defined(__amd64__)
char vm_guest[16] = "";
size_t len = sizeof(vm_guest);
char *dztpath;
skiputc = false;
/* Default skiputc to true for VM guests */
if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) == 0 &&
strcmp(vm_guest, "none") != 0)
skiputc = true;
#else
skiputc = true;
#endif
dztpath = NULL;
skiputc = 0;
#ifdef HAVE_BSDDIALOG
setlocale(LC_ALL, "");
#endif
/* Default skiputc to 1 for VM guests */
if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) == 0 &&
strcmp(vm_guest, "none") != 0)
skiputc = 1;
while ((c = getopt(argc, argv, "C:d:nrs")) != -1) {
switch (c) {
case 'C':
@ -861,7 +866,7 @@ main(int argc, char **argv)
#endif
break;
case 's':
skiputc = 1;
skiputc = true;
break;
default:
usage();
@ -951,7 +956,7 @@ main(int argc, char **argv)
if (bsddialog_init() == BSDDIALOG_ERROR)
errx(1, "Error bsddialog: %s\n", bsddialog_geterror());
if (skiputc == 0) {
if (!skiputc) {
snprintf(prompt, sizeof(prompt),
"Is this machine's CMOS clock set to UTC? "
"If it is set to local time,\n"