summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-04-13 19:31:59 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-04-13 19:31:59 +0000
commitf65938d9608dfd0ab834ed9a3cac13e9f830a552 (patch)
tree9473d4887ae6159a1ac5b1ba12f68f422c13d0c6 /usr.bin
parent091eebdab94e4895085f569edd92b4c2fb6b4d78 (diff)
My clever "expand _PATH_STDPATH in whereis.1" logic broke the build if
you forgot to make obj first. Switch to putting the path in the manpage and just verifying at build-time whether it's correct. Problem pointed out by rpe@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/which/Makefile28
-rw-r--r--usr.bin/which/whereis.17
2 files changed, 14 insertions, 21 deletions
diff --git a/usr.bin/which/Makefile b/usr.bin/which/Makefile
index aaf1ad96961..19c6be1a703 100644
--- a/usr.bin/which/Makefile
+++ b/usr.bin/which/Makefile
@@ -1,26 +1,18 @@
-# $OpenBSD: Makefile,v 1.6 2013/04/10 02:57:20 guenther Exp $
-
-whereis_MAN = ${.OBJDIR}/whereis.1
-man_depends = ${.OBJDIR}/whereis.d
+# $OpenBSD: Makefile,v 1.7 2013/04/13 19:31:58 guenther Exp $
PROG= which
-MAN= which.1 ${whereis_MAN}
+MAN= which.1 whereis.1
LINKS= ${BINDIR}/which ${BINDIR}/whereis
-${whereis_MAN}: ${.CURDIR}/whereis.1 /usr/include/paths.h
+check_path_in_man:
stdpath=`printf '#include <paths.h>\n_PATH_STDPATH\n' | \
- ${CPP} ${CPPFLAGS} -MD -MT '$${.OBJDIR}/whereis.1' \
- -MF ${man_depends} - | \
- sed -n 's/^[ ]*"\(.*\)".*/\1/p'` ; \
- sed "s!_PATH_STDPATH!$${stdpath}!" < ${.CURDIR}/whereis.1 >$@
-
-CLEANFILES = ${whereis_MAN}
-cleandir: cleanlocaldepend
-cleanlocaldepend:
- rm -f ${man_depends}
+ ${CPP} ${CPPFLAGS} - | \
+ sed -n 's/^[ ]*"\(.*\)".*/.Pa \1 ./p'` ; \
+ fgrep -xq "$$stdpath" ${.CURDIR}/whereis.1 && { touch $@; exit 0; }; \
+ echo "Update the expansion of _PATH_STDPATH in ${.CURDIR}/whereis.1"; \
+ exit 1
-.if exists(${man_depends})
-. include "${man_depends}"
-.endif
+all: check_path_in_man
+CLEANFILES = check_path_in_man
.include <bsd.prog.mk>
diff --git a/usr.bin/which/whereis.1 b/usr.bin/which/whereis.1
index 8e55e1b1add..3d846454653 100644
--- a/usr.bin/which/whereis.1
+++ b/usr.bin/which/whereis.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: whereis.1,v 1.16 2013/04/10 02:57:20 guenther Exp $
+.\" $OpenBSD: whereis.1,v 1.17 2013/04/13 19:31:58 guenther Exp $
.\" $NetBSD: whereis.1,v 1.4 1995/08/31 21:54:51 jtc Exp $
.\"
.\" Copyright (c) 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)whereis.1 8.3 (Berkeley) 4/27/95
.\"
-.Dd $Mdocdate: April 10 2013 $
+.Dd $Mdocdate: April 13 2013 $
.Dt WHEREIS 1
.Os
.Sh NAME
@@ -49,7 +49,8 @@ printing out the paths of any it finds that are executable by the
user.
.Pp
The path searched is
-.Pa _PATH_STDPATH .
+.\" The path below should be the expansion of _PATH_STDPATH from <paths.h>
+.Pa /usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin .
.Pp
If the
.Fl a