summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/dir.c
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2007-01-18 17:49:51 +0000
committerespie <espie@openbsd.org>2007-01-18 17:49:51 +0000
commit018b58ec6cdefa2575011b610991dbb0b43a3f6c (patch)
tree00273a2fcea2716813bd8b37c7880902d71f2dca /usr.bin/make/dir.c
parentimport improvements: (diff)
downloadwireguard-openbsd-018b58ec6cdefa2575011b610991dbb0b43a3f6c.tar.xz
wireguard-openbsd-018b58ec6cdefa2575011b610991dbb0b43a3f6c.zip
* add an extra argument to the dir lookup functions to say whether we
should look in the current directory. * refactor include files treatment to have a separate function to look for an include. * use both pieces to make sure system includes do not get looked up in the current directory unless everything else fails. This is != from the netbsd solution to the same problem, which stuffs `magic' entries into filepaths to say whether dot should be looked at first or last. feature requested by matthieu@. okay matthieu@
Diffstat (limited to 'usr.bin/make/dir.c')
-rw-r--r--usr.bin/make/dir.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index 7efba0a230a..9b0afd2ae26 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: dir.c,v 1.44 2006/01/20 23:10:19 espie Exp $ */
+/* $OpenBSD: dir.c,v 1.45 2007/01/18 17:49:51 espie Exp $ */
/* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */
/*
@@ -634,7 +634,8 @@ Dir_Expandi(const char *word, const char *eword, Lst path, Lst expansions)
* that directory later on.
*/
char *
-Dir_FindFilei(const char *name, const char *ename, Lst path)
+Dir_FindFileComplexi(const char *name, const char *ename, Lst path,
+ bool checkCurdirFirst)
{
Path *p; /* current path member */
char *p1; /* pointer into p->name */
@@ -664,10 +665,10 @@ Dir_FindFilei(const char *name, const char *ename, Lst path)
if (DEBUG(DIR))
printf("Searching for %s...", name);
- /* No matter what, we always look for the file in the current directory
- * before anywhere else and we always return exactly what the caller
- * specified. */
- if ((!hasSlash || (cp - name == 2 && *name == '.')) &&
+ /* Unless checkCurDirFirst is false, we always look for
+ * the file in the current directory before anywhere else
+ * and we always return exactly what the caller specified. */
+ if (checkCurdirFirst && (!hasSlash || (cp - name == 2 && *name == '.')) &&
find_file_hashi(dot, cp, ename, hv) != NULL) {
if (DEBUG(DIR))
printf("in '.'\n");