Module Name:    src
Committed By:   christos
Date:           Mon Jan 29 22:01:58 UTC 2024

Modified Files:
        src/usr.bin/stat: Makefile stat.c

Log Message:
fix tools build


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/stat/Makefile
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/stat/stat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/stat/Makefile
diff -u src/usr.bin/stat/Makefile:1.14 src/usr.bin/stat/Makefile:1.15
--- src/usr.bin/stat/Makefile:1.14	Mon Jan 29 16:55:24 2024
+++ src/usr.bin/stat/Makefile	Mon Jan 29 17:01:58 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.14 2024/01/29 21:55:24 christos Exp $
+#	$NetBSD: Makefile,v 1.15 2024/01/29 22:01:58 christos Exp $
 
 PROG=	stat
 
@@ -14,7 +14,9 @@ COPTS.stat.c+=	${CC_WNO_IMPLICIT_FALLTHR
 
 COPTS.stat.c += -Wno-format-nonliteral
 
+.if !defined(HOSTPROG)
 LDADD+=	-lutil
 DPADD+=	${LIBUTIL}
+.endif
 
 .include <bsd.prog.mk>

Index: src/usr.bin/stat/stat.c
diff -u src/usr.bin/stat/stat.c:1.49 src/usr.bin/stat/stat.c:1.50
--- src/usr.bin/stat/stat.c:1.49	Mon Jan 29 16:55:24 2024
+++ src/usr.bin/stat/stat.c	Mon Jan 29 17:01:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stat.c,v 1.49 2024/01/29 21:55:24 christos Exp $ */
+/*	$NetBSD: stat.c,v 1.50 2024/01/29 22:01:58 christos Exp $ */
 
 /*
  * Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: stat.c,v 1.49 2024/01/29 21:55:24 christos Exp $");
+__RCSID("$NetBSD: stat.c,v 1.50 2024/01/29 22:01:58 christos Exp $");
 #endif
 
 #if ! HAVE_NBTOOL_CONFIG_H
@@ -63,7 +63,7 @@ __RCSID("$NetBSD: stat.c,v 1.49 2024/01/
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS && !HAVE_NBTOOL_CONFIG_H
 #include <util.h>
 #endif
 #include <vis.h>
@@ -870,9 +870,11 @@ format1(const struct stat *st,
 	case SHOW_st_flags:
 		small = (sizeof(st->st_flags) == 4);
 		data = st->st_flags;
+		formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+#if !HAVE_NBTOOL_CONFIG_H
 		sdata = flags_to_string((u_long)st->st_flags, "-");
-		formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
-		    FMTF_STRING;
+		formats |= FMT_STRING;
+#endif
 		if (ofmt == 0)
 			ofmt = FMTF_UNSIGNED;
 		break;

Reply via email to