Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/date tool changes



details:   https://anonhg.NetBSD.org/src/rev/0d1f74937b6a
branches:  trunk
changeset: 1021320:0d1f74937b6a
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 26 20:19:51 2021 +0000

description:
tool changes

diffstat:

 bin/date/Makefile |   9 +++++++--
 bin/date/date.c   |  17 +++++++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diffs (87 lines):

diff -r 0267f8c25ccc -r 0d1f74937b6a bin/date/Makefile
--- a/bin/date/Makefile Wed May 26 20:19:15 2021 +0000
+++ b/bin/date/Makefile Wed May 26 20:19:51 2021 +0000
@@ -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
diff -r 0267f8c25ccc -r 0d1f74937b6a bin/date/date.c
--- a/bin/date/date.c   Wed May 26 20:19:15 2021 +0000
+++ b/bin/date/date.c   Wed May 26 20:19:51 2021 +0000
@@ -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 @@
 #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 @@
                        nflag = 1;
                        break;
                case 'd':
+#ifndef HAVE_NBTOOL_CONFIG_H
                        rflag = 1;
                        tval = parsedate(optarg, NULL, NULL);
                        if (tval == -1) {
@@ -97,6 +102,10 @@
                                    "%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 @@
        }
 
        /* set the time */
+#ifndef HAVE_NBTOOL_CONFIG_H
        if (nflag || netsettime(new_time)) {
                logwtmp("|", "date", "");
                if (aflag) {
@@ -346,6 +356,9 @@
                }
                logwtmp("{", "date", "");
        }
+#else
+       errx(EXIT_FAILURE, "Can't set the time in the tools version");
+#endif
 
        if ((p = getlogin()) == NULL)
                p = "???";



Home | Main Index | Thread Index | Old Index