summaryrefslogtreecommitdiff
path: root/vpath.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-05-17 02:29:46 -0400
committerPaul Smith <psmith@gnu.org>2013-05-17 02:29:46 -0400
commit96cf67bd29957cfde6c5f15cfec7e370c6dbabe2 (patch)
treed59d8a6fd1a43f4e985654466a9bd7bd5df8cf46 /vpath.c
parent5370238316ee4284fe058a9c298a5734d2686678 (diff)
downloadgunmake-96cf67bd29957cfde6c5f15cfec7e370c6dbabe2.tar.gz
Update source file format: remove TABs, use GNU coding styles.
Diffstat (limited to 'vpath.c')
-rw-r--r--vpath.c196
1 files changed, 98 insertions, 98 deletions
diff --git a/vpath.c b/vpath.c
index 46bbfe0..5b7ea93 100644
--- a/vpath.c
+++ b/vpath.c
@@ -26,7 +26,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
struct vpath
{
- struct vpath *next; /* Pointer to next struct in the linked list. */
+ struct vpath *next; /* Pointer to next struct in the linked list. */
const char *pattern;/* The pattern to match. */
const char *percent;/* Pointer into 'pattern' where the '%' is. */
unsigned int patlen;/* Length of the pattern. */
@@ -89,14 +89,14 @@ build_vpath_lists ()
char gp[] = "%";
/* Empty 'vpaths' so the new one will have no next, and 'vpaths'
- will still be nil if P contains no existing directories. */
+ will still be nil if P contains no existing directories. */
vpaths = 0;
/* Parse P. */
construct_vpath_list (gp, p);
/* Store the created path as the general path,
- and restore the old list of vpaths. */
+ and restore the old list of vpaths. */
general_vpath = vpaths;
vpaths = save_vpaths;
}
@@ -122,14 +122,14 @@ build_vpath_lists ()
char gp[] = "%";
/* Empty 'vpaths' so the new one will have no next, and 'vpaths'
- will still be nil if P contains no existing directories. */
+ will still be nil if P contains no existing directories. */
vpaths = 0;
/* Parse P. */
construct_vpath_list (gp, p);
/* Store the created path as the GPATH,
- and restore the old list of vpaths. */
+ and restore the old list of vpaths. */
gpaths = vpaths;
vpaths = save_vpaths;
}
@@ -175,36 +175,36 @@ construct_vpath_list (char *pattern, char *dirpath)
lastpath = 0;
path = vpaths;
while (path != 0)
- {
- struct vpath *next = path->next;
-
- if (pattern == 0
- || (((percent == 0 && path->percent == 0)
- || (percent - pattern == path->percent - path->pattern))
- && streq (pattern, path->pattern)))
- {
- /* Remove it from the linked list. */
- if (lastpath == 0)
- vpaths = path->next;
- else
- lastpath->next = next;
-
- /* Free its unused storage. */
+ {
+ struct vpath *next = path->next;
+
+ if (pattern == 0
+ || (((percent == 0 && path->percent == 0)
+ || (percent - pattern == path->percent - path->pattern))
+ && streq (pattern, path->pattern)))
+ {
+ /* Remove it from the linked list. */
+ if (lastpath == 0)
+ vpaths = path->next;
+ else
+ lastpath->next = next;
+
+ /* Free its unused storage. */
/* MSVC erroneously warns without a cast here. */
- free ((void *)path->searchpath);
- free (path);
- }
- else
- lastpath = path;
+ free ((void *)path->searchpath);
+ free (path);
+ }
+ else
+ lastpath = path;
- path = next;
- }
+ path = next;
+ }
return;
}
#ifdef WINDOWS32
- convert_vpath_to_windows32(dirpath, ';');
+ convert_vpath_to_windows32 (dirpath, ';');
#endif
/* Skip over any initial separators and blanks. */
@@ -235,49 +235,49 @@ construct_vpath_list (char *pattern, char *dirpath)
v = p;
while (*p != '\0'
#if defined(HAVE_DOS_PATHS) && (PATH_SEPARATOR_CHAR == ':')
- /* Platforms whose PATH_SEPARATOR_CHAR is ':' and which
- also define HAVE_DOS_PATHS would like us to recognize
- colons after the drive letter in the likes of
- "D:/foo/bar:C:/xyzzy". */
- && (*p != PATH_SEPARATOR_CHAR
- || (p == v + 1 && (p[1] == '/' || p[1] == '\\')))
+ /* Platforms whose PATH_SEPARATOR_CHAR is ':' and which
+ also define HAVE_DOS_PATHS would like us to recognize
+ colons after the drive letter in the likes of
+ "D:/foo/bar:C:/xyzzy". */
+ && (*p != PATH_SEPARATOR_CHAR
+ || (p == v + 1 && (p[1] == '/' || p[1] == '\\')))
#else
- && *p != PATH_SEPARATOR_CHAR
+ && *p != PATH_SEPARATOR_CHAR
#endif
- && !isblank ((unsigned char)*p))
- ++p;
+ && !isblank ((unsigned char)*p))
+ ++p;
len = p - v;
/* Make sure there's no trailing slash,
- but still allow "/" as a directory. */
+ but still allow "/" as a directory. */
#if defined(__MSDOS__) || defined(__EMX__) || defined(HAVE_DOS_PATHS)
/* We need also to leave alone a trailing slash in "d:/". */
if (len > 3 || (len > 1 && v[1] != ':'))
#endif
if (len > 1 && p[-1] == '/')
- --len;
+ --len;
/* Put the directory on the vpath list. */
if (len > 1 || *v != '.')
- {
+ {
vpath[elem++] = dir_name (strcache_add_len (v, len));
if (len > maxvpath)
maxvpath = len;
- }
+ }
/* Skip over separators and blanks between entries. */
while (*p == PATH_SEPARATOR_CHAR || isblank ((unsigned char)*p))
- ++p;
+ ++p;
}
if (elem > 0)
{
struct vpath *path;
/* ELEM is now incremented one element past the last
- entry, to where the nil-pointer terminator goes.
- Usually this is maxelem - 1. If not, shrink down. */
+ entry, to where the nil-pointer terminator goes.
+ Usually this is maxelem - 1. If not, shrink down. */
if (elem < (maxelem - 1))
- vpath = xrealloc (vpath, (elem+1) * sizeof (const char *));
+ vpath = xrealloc (vpath, (elem+1) * sizeof (const char *));
/* Put the nil-pointer terminator on the end of the VPATH list. */
vpath[elem] = NULL;
@@ -355,7 +355,7 @@ selective_vpath_search (struct vpath *path, const char *file,
#ifdef HAVE_DOS_PATHS
/* We need the rightmost slash or backslash. */
{
- const char *bslash = strrchr(file, '\\');
+ const char *bslash = strrchr (file, '\\');
if (!n || bslash > n)
n = bslash;
}
@@ -385,43 +385,43 @@ selective_vpath_search (struct vpath *path, const char *file,
/* Add the directory prefix already in *FILE. */
if (name_dplen > 0)
- {
+ {
#ifndef VMS
- *p++ = '/';
+ *p++ = '/';
#endif
- memcpy (p, file, name_dplen);
- p += name_dplen;
- }
+ memcpy (p, file, name_dplen);
+ p += name_dplen;
+ }
#ifdef HAVE_DOS_PATHS
/* Cause the next if to treat backslash and slash alike. */
if (p != name && p[-1] == '\\' )
- p[-1] = '/';
+ p[-1] = '/';
#endif
/* Now add the name-within-directory at the end of NAME. */
#ifndef VMS
if (p != name && p[-1] != '/')
- {
- *p = '/';
- memcpy (p + 1, filename, flen + 1);
- }
+ {
+ *p = '/';
+ memcpy (p + 1, filename, flen + 1);
+ }
else
#endif
- memcpy (p, filename, flen + 1);
+ memcpy (p, filename, flen + 1);
/* Check if the file is mentioned in a makefile. If *FILE is not
- a target, that is enough for us to decide this file exists.
- If *FILE is a target, then the file must be mentioned in the
- makefile also as a target to be chosen.
+ a target, that is enough for us to decide this file exists.
+ If *FILE is a target, then the file must be mentioned in the
+ makefile also as a target to be chosen.
- The restriction that *FILE must not be a target for a
- makefile-mentioned file to be chosen was added by an
- inadequately commented change in July 1990; I am not sure off
- hand what problem it fixes.
+ The restriction that *FILE must not be a target for a
+ makefile-mentioned file to be chosen was added by an
+ inadequately commented change in July 1990; I am not sure off
+ hand what problem it fixes.
- In December 1993 I loosened this restriction to allow a file
- to be chosen if it is mentioned as a target in a makefile. This
- seem logical.
+ In December 1993 I loosened this restriction to allow a file
+ to be chosen if it is mentioned as a target in a makefile. This
+ seem logical.
Special handling for -W / -o: make sure we preserve the special
values here. Actually this whole thing is a little bogus: I think
@@ -431,8 +431,8 @@ selective_vpath_search (struct vpath *path, const char *file,
we use it.
*/
{
- struct file *f = lookup_file (name);
- if (f != 0)
+ struct file *f = lookup_file (name);
+ if (f != 0)
{
exists = not_target || f->is_target;
if (exists && mtime_ptr
@@ -445,41 +445,41 @@ selective_vpath_search (struct vpath *path, const char *file,
}
if (!exists)
- {
- /* That file wasn't mentioned in the makefile.
- See if it actually exists. */
+ {
+ /* That file wasn't mentioned in the makefile.
+ See if it actually exists. */
#ifdef VMS
- exists_in_cache = exists = dir_file_exists_p (vpath[i], filename);
+ exists_in_cache = exists = dir_file_exists_p (vpath[i], filename);
#else
- /* Clobber a null into the name at the last slash.
- Now NAME is the name of the directory to look in. */
- *p = '\0';
-
- /* We know the directory is in the hash table now because either
- construct_vpath_list or the code just above put it there.
- Does the file we seek exist in it? */
- exists_in_cache = exists = dir_file_exists_p (name, filename);
+ /* Clobber a null into the name at the last slash.
+ Now NAME is the name of the directory to look in. */
+ *p = '\0';
+
+ /* We know the directory is in the hash table now because either
+ construct_vpath_list or the code just above put it there.
+ Does the file we seek exist in it? */
+ exists_in_cache = exists = dir_file_exists_p (name, filename);
#endif
- }
+ }
if (exists)
- {
- /* The file is in the directory cache.
- Now check that it actually exists in the filesystem.
- The cache may be out of date. When vpath thinks a file
- exists, but stat fails for it, confusion results in the
- higher levels. */
+ {
+ /* The file is in the directory cache.
+ Now check that it actually exists in the filesystem.
+ The cache may be out of date. When vpath thinks a file
+ exists, but stat fails for it, confusion results in the
+ higher levels. */
- struct stat st;
+ struct stat st;
#ifndef VMS
- /* Put the slash back in NAME. */
- *p = '/';
+ /* Put the slash back in NAME. */
+ *p = '/';
#endif
- if (exists_in_cache) /* Makefile-mentioned file need not exist. */
- {
+ if (exists_in_cache) /* Makefile-mentioned file need not exist. */
+ {
int e;
EINTRLOOP (e, stat (name, &st)); /* Does it really exist? */
@@ -509,7 +509,7 @@ selective_vpath_search (struct vpath *path, const char *file,
*path_index = i;
return strcache_add_len (name, (p + 1 - name) + flen);
- }
+ }
}
return 0;
@@ -593,8 +593,8 @@ print_vpath_data_base (void)
printf ("vpath %s ", v->pattern);
for (i = 0; v->searchpath[i] != 0; ++i)
- printf ("%s%c", v->searchpath[i],
- v->searchpath[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
+ printf ("%s%c", v->searchpath[i],
+ v->searchpath[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
}
if (vpaths == 0)
@@ -612,7 +612,7 @@ print_vpath_data_base (void)
fputs (_("\n# General ('VPATH' variable) search path:\n# "), stdout);
for (i = 0; path[i] != 0; ++i)
- printf ("%s%c", path[i],
- path[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
+ printf ("%s%c", path[i],
+ path[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
}
}