Module Name: src
Committed By: christos
Date: Wed May 26 20:19:51 UTC 2021
Modified Files:
src/bin/date: Makefile date.c
Log Message:
tool changes
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/date/Makefile
cvs rdiff -u -r1.61 -r1.62 src/bin/date/date.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/date/Makefile
diff -u src/bin/date/Makefile:1.15 src/bin/date/Makefile:1.16
--- src/bin/date/Makefile:1.15 Sun Aug 14 06:53:16 2011
+++ src/bin/date/Makefile Wed May 26 16:19:51 2021
@@ -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
+.include <bsd.init.mk>
+
PROG= date
-SRCS= date.c netdate.c
+SRCS= date.c
+.if !defined(HOSTPROG)
+SRCS+= netdate.c
DPADD+= ${LIBUTIL}
LDADD+= -lutil
+.endif
CPPFLAGS+=-I${.CURDIR}
COPTS.date.c = -Wno-format-nonliteral
Index: src/bin/date/date.c
diff -u src/bin/date/date.c:1.61 src/bin/date/date.c:1.62
--- src/bin/date/date.c:1.61 Mon Sep 1 17:42:21 2014
+++ src/bin/date/date.c Wed May 26 16:19:51 2021
@@ -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
@@ -29,6 +29,10 @@
* SUCH DAMAGE.
*/
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
#include <sys/cdefs.h>
#ifndef lint
__COPYRIGHT(
@@ -40,7 +44,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)date.c 8.2 (Berkeley) 4/28/95";
#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 /* not lint */
@@ -90,6 +94,7 @@ main(int argc, char *argv[])
nflag = 1;
break;
case 'd':
+#ifndef HAVE_NBTOOL_CONFIG_H
rflag = 1;
tval = parsedate(optarg, NULL, NULL);
if (tval == -1) {
@@ -97,6 +102,10 @@ main(int argc, char *argv[])
"%s: Unrecognized date format", optarg);
}
break;
+#else
+ errx(EXIT_FAILURE,
+ "-d not supported in the tool version");
+#endif
case 'j': /* don't set time */
jflag = 1;
break;
@@ -330,6 +339,7 @@ setthetime(const char *p)
}
/* set the time */
+#ifndef HAVE_NBTOOL_CONFIG_H
if (nflag || netsettime(new_time)) {
logwtmp("|", "date", "");
if (aflag) {
@@ -346,6 +356,9 @@ setthetime(const char *p)
}
logwtmp("{", "date", "");
}
+#else
+ errx(EXIT_FAILURE, "Can't set the time in the tools version");
+#endif
if ((p = getlogin()) == NULL)
p = "???";