summaryrefslogtreecommitdiff
path: root/remake.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1993-01-21 22:24:55 +0000
committerRoland McGrath <roland@redhat.com>1993-01-21 22:24:55 +0000
commite8a9cedc6acd0357ba60ed452f10b8499c8126f1 (patch)
treedff23694b8246ec396b7692ff669eff9401482af /remake.c
parent44078a3441c54436868a0dced0cee5b7b8a26e48 (diff)
downloadgunmake-e8a9cedc6acd0357ba60ed452f10b8499c8126f1.tar.gz
Formerly remake.c.~42~
Diffstat (limited to 'remake.c')
-rw-r--r--remake.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/remake.c b/remake.c
index 5131ee8..20d1eea 100644
--- a/remake.c
+++ b/remake.c
@@ -932,15 +932,16 @@ library_search (lib)
0
};
- char *libname = &(*lib)[2];
- char *buf = xmalloc (sizeof (LIBDIR) + 8 + strlen (libname) + 4 + 2 + 1);
- char **dp;
+ char *libname = &(*lib)[2]; /* Name without the `-l'. */
- sprintf (buf, "lib%s.a", libname);
+ /* Buffer to construct possible names in. */
+ char *buf = xmalloc (sizeof (LIBDIR) + 8 + strlen (libname) + 4 + 2 + 1);
+ char *file, **dp;
/* Look first for `libNAME.a' in the current directory. */
- if (name_mtime (libname) != (time_t) -1)
+ sprintf (buf, "lib%s.a", libname);
+ if (name_mtime (buf) != (time_t) -1)
{
*lib = buf;
return 1;
@@ -948,11 +949,11 @@ library_search (lib)
/* Now try VPATH search on that. */
- libname = buf;
- if (vpath_search (&libname))
+ file = buf;
+ if (vpath_search (&file))
{
free (buf);
- *lib = libname;
+ *lib = file;
return 1;
}
@@ -960,7 +961,7 @@ library_search (lib)
for (dp = dirs; *dp != 0; ++dp)
{
- sprintf (buf, "%s/lib%s.a", *dp, &(*lib)[2]);
+ sprintf (buf, "%s/lib%s.a", *dp, libname);
if (name_mtime (buf) != (time_t) -1)
{
*lib = buf;