Make used to add every directory where it found files in the search path.

I.e. if you had a line in your Makefile:
	../foo.o: foo.c
`..' would be added in the search path. The addition of such paths has
been now disabled. If a pathname contains a slash, then the directory
where such a file is found is not added to the search path. Of course
this eliminates most (all?) use of this function.
This commit is contained in:
christos 1997-05-02 14:23:51 +00:00
parent a05df4e228
commit 6cfa2388a9
1 changed files with 23 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */ /* $NetBSD: dir.c,v 1.15 1997/05/02 14:23:51 christos Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -42,7 +42,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else #else
static char rcsid[] = "$NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $"; static char rcsid[] = "$NetBSD: dir.c,v 1.15 1997/05/02 14:23:51 christos Exp $";
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -853,20 +853,27 @@ Dir_FindFile (name, path)
Lst_Close (path); Lst_Close (path);
/* if (!hasSlash) {
* We've found another directory to search. We know there's /*
* a slash in 'file' because we put one there. We nuke it after * If the file did not have originally a slash,
* finding it and call Dir_AddDir to add this new directory * and we've found it after we've added a pathname,
* onto the existing search path. Once that's done, we restore * we've found another directory to search. We
* the slash and triumphantly return the file name, knowing * know there's a slash in 'file' because we
* that should a file in this directory every be referenced * put one there. We nuke it after finding it
* again in such a manner, we will find it without having to do * and call Dir_AddDir to add this new directory
* numerous numbers of access calls. Hurrah! * onto the existing search path. Once that's
*/ * done, we restore the slash and triumphantly
cp = strrchr (file, '/'); * return the file name, knowing that should
*cp = '\0'; a file in this directory every be referenced
Dir_AddDir (path, file); * again in such a manner, we will find it
*cp = '/'; * without having to do numerous numbers of
* access calls. Hurrah!
*/
cp = strrchr (file, '/');
*cp = '\0';
Dir_AddDir (path, file);
*cp = '/';
}
/* /*
* Save the modification time so if it's needed, we don't have * Save the modification time so if it's needed, we don't have