diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-10-23 01:57:33 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-10-23 01:57:33 +0000 |
commit | 3afac5a8ec1fc1a600ee4d70cf1f87b2183567e9 (patch) | |
tree | d62a2c6a46cc3bd95fb96d6d75f2b96b00c03064 /usr.bin | |
parent | dca183b31a86b1189d63c928174722fb36a088d1 (diff) | |
download | FreeBSD-src-3afac5a8ec1fc1a600ee4d70cf1f87b2183567e9.zip FreeBSD-src-3afac5a8ec1fc1a600ee4d70cf1f87b2183567e9.tar.gz |
De-obfuscate and correct the include path handling for SysV style includes.
PR: 32759
Submitted by: Mark Valentine
Reviewed by: Matthew Emmerton" <matt@gsicomp.on.ca>
MFC after: 15 days
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/parse.c | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index c19f679..1e6c641 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1823,7 +1823,6 @@ ParseTraditionalInclude (char *file) char *fullname; /* full pathname of file */ IFile *oldFile; /* state associated with current file */ char *cp; /* current position in file spec */ - char *prefEnd; /* * Skip over whitespace @@ -1855,42 +1854,12 @@ ParseTraditionalInclude (char *file) /* * Now we know the file's name, we attempt to find the durn thing. - * A return of NULL indicates the file don't exist. - * - * Include files are first searched for relative to the including - * file's location. We don't want to cd there, of course, so we - * just tack on the old file's leading path components and call - * Dir_FindFile to see if we can locate the beast. - * XXX - this *does* search in the current directory, right? + * Search for it first on the -I search path, then on the .PATH + * search path, if not found in a -I directory. */ - - prefEnd = strrchr (fname, '/'); - if (prefEnd != (char *)NULL) { - char *newName; - - *prefEnd = '\0'; - newName = str_concat (fname, file, STR_ADDSLASH); - fullname = Dir_FindFile (newName, parseIncPath); - if (fullname == (char *)NULL) { - fullname = Dir_FindFile(newName, dirSearchPath); - } - free (newName); - *prefEnd = '/'; - } else { - fullname = (char *)NULL; - } - + fullname = Dir_FindFile (file, parseIncPath); if (fullname == (char *)NULL) { - /* - * System makefile or makefile wasn't found in same directory as - * included makefile. Search for it first on the -I search path, - * then on the .PATH search path, if not found in a -I directory. - * XXX: Suffix specific? - */ - fullname = Dir_FindFile (file, parseIncPath); - if (fullname == (char *)NULL) { - fullname = Dir_FindFile(file, dirSearchPath); - } + fullname = Dir_FindFile(file, dirSearchPath); } if (fullname == (char *)NULL) { |