Changeset 671


Ignore:
Timestamp:
Sep 9, 2003, 1:33:26 PM (22 years ago)
Author:
bird
Message:

#627: Fixed problems related walking LIB.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxomf/emxomfld.c

    • Property cvs2svn:cvs-rev changed from 1.27 to 1.28
    r670 r671  
    516516}
    517517
    518 /* finds the full path of a library or object file.
     518/* Finds the full path of a library or object file.
    519519
    520520   Object files and libraries will be searched for using the LIB env.var
     
    529529   if one without the 'lib' prefix was not found. The '.o' and '.a'
    530530   extensions are tried in the last case since otherwise we can find
    531    a 'something.a' when 'libsomething.lib' is available.
    532 */
     531   a 'something.a' when 'libsomething.lib' is available. */
    533532
    534533static FILE *find_objlib (char *fullname, const char *name, int is_library)
     
    537536  FILE *f;
    538537  size_t pathlen, namelen = strlen (name);
    539   char *libpath, *x;
     538  const char *libpath, *x;
    540539  int i, has_ext = 0, has_path;
    541540
     
    553552      if (x)
    554553        for (i = 0; i < 2; i++)
    555           if (strcmp (x, exts [is_library][i]) == 0)
     554          if (!stricmp (x, exts [is_library][i]))
    556555            {
    557556              has_ext = 1;
     
    564563  libpath = getenv ("LIB");
    565564  pathlen = 0;
     565  if (!has_path)
     566    {
     567      memcpy(fullname, ".\\", 2);
     568      pathlen = 2;
     569    }
    566570  do
    567571    {
     
    575579          char *cur = fullname + pathlen;
    576580
    577           if ((i & 1) && !is_library)
     581          if ((i & 1) && (!is_library || has_path))
    578582            continue;
    579583
     
    601605              else
    602606                {
    603                   /* Replace forward slashes with backslashes
    604                      since Knut likes them :) */
     607                  /* Replace forward slashes with backslashes (link386). */
    605608                  while ((fullname = strchr (fullname, '/')) != NULL)
    606609                    *fullname++ = '\\';
     
    613616        break;
    614617
    615       /* Find where next LIB component ends */
    616       x = strchr (libpath, ';');
    617       if (!x) x = strchr (libpath, 0);
    618       pathlen = x - libpath;
    619 
    620       if (pathlen)
    621         {
    622           memcpy (fullname, libpath, pathlen);
    623           /* Append last slash if it is not there */
    624           if (fullname [pathlen - 1] != '/'
    625            && fullname [pathlen - 1] != '\\')
    626             fullname [pathlen++] = '\\';
    627         }
    628 
    629       /* Advance past ';' in LIB */
    630       libpath = x + 1;
    631     } while (*x);
     618      /* Find the next LIB component.
     619         We're skipping empty components. */
     620      for (;;)
     621        {
     622          x = strchr (libpath, ';');
     623          if (!x) x = strchr (libpath, 0);
     624          pathlen = x - libpath;
     625          if (pathlen)
     626            {
     627              memcpy (fullname, libpath, pathlen);
     628              libpath = x + (*x == ';');
     629              /* Append last slash if it is not there */
     630              if (fullname [pathlen - 1] != '/'
     631               && fullname [pathlen - 1] != '\\')
     632                fullname [pathlen++] = '\\';
     633              break;
     634            }
     635          if (!*x)
     636            break;
     637          libpath = x + (*x == ';');
     638        }
     639    } while (pathlen);
    632640
    633641  return NULL;
Note: See TracChangeset for help on using the changeset viewer.