tool changes

This commit is contained in:
christos 2021-05-26 20:19:51 +00:00
parent f5c6b13fa0
commit 634a80273e
2 changed files with 22 additions and 4 deletions

View File

@ -1,10 +1,15 @@
# $NetBSD: Makefile,v 1.15 2011/08/14 10:53:16 christos Exp $ # $NetBSD: Makefile,v 1.16 2021/05/26 20:19:51 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93 # @(#)Makefile 8.1 (Berkeley) 5/31/93
.include <bsd.init.mk>
PROG= date PROG= date
SRCS= date.c netdate.c SRCS= date.c
.if !defined(HOSTPROG)
SRCS+= netdate.c
DPADD+= ${LIBUTIL} DPADD+= ${LIBUTIL}
LDADD+= -lutil LDADD+= -lutil
.endif
CPPFLAGS+=-I${.CURDIR} CPPFLAGS+=-I${.CURDIR}
COPTS.date.c = -Wno-format-nonliteral COPTS.date.c = -Wno-format-nonliteral

View File

@ -1,4 +1,4 @@
/* $NetBSD: date.c,v 1.61 2014/09/01 21:42:21 dholland Exp $ */ /* $NetBSD: date.c,v 1.62 2021/05/26 20:19:51 christos Exp $ */
/* /*
* Copyright (c) 1985, 1987, 1988, 1993 * Copyright (c) 1985, 1987, 1988, 1993
@ -29,6 +29,10 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__COPYRIGHT( __COPYRIGHT(
@ -40,7 +44,7 @@ __COPYRIGHT(
#if 0 #if 0
static char sccsid[] = "@(#)date.c 8.2 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)date.c 8.2 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: date.c,v 1.61 2014/09/01 21:42:21 dholland Exp $"); __RCSID("$NetBSD: date.c,v 1.62 2021/05/26 20:19:51 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -90,6 +94,7 @@ main(int argc, char *argv[])
nflag = 1; nflag = 1;
break; break;
case 'd': case 'd':
#ifndef HAVE_NBTOOL_CONFIG_H
rflag = 1; rflag = 1;
tval = parsedate(optarg, NULL, NULL); tval = parsedate(optarg, NULL, NULL);
if (tval == -1) { if (tval == -1) {
@ -97,6 +102,10 @@ main(int argc, char *argv[])
"%s: Unrecognized date format", optarg); "%s: Unrecognized date format", optarg);
} }
break; break;
#else
errx(EXIT_FAILURE,
"-d not supported in the tool version");
#endif
case 'j': /* don't set time */ case 'j': /* don't set time */
jflag = 1; jflag = 1;
break; break;
@ -330,6 +339,7 @@ setthetime(const char *p)
} }
/* set the time */ /* set the time */
#ifndef HAVE_NBTOOL_CONFIG_H
if (nflag || netsettime(new_time)) { if (nflag || netsettime(new_time)) {
logwtmp("|", "date", ""); logwtmp("|", "date", "");
if (aflag) { if (aflag) {
@ -346,6 +356,9 @@ setthetime(const char *p)
} }
logwtmp("{", "date", ""); logwtmp("{", "date", "");
} }
#else
errx(EXIT_FAILURE, "Can't set the time in the tools version");
#endif
if ((p = getlogin()) == NULL) if ((p = getlogin()) == NULL)
p = "???"; p = "???";