Changeset 455


Ignore:
Timestamp:
Jul 28, 2003, 12:21:05 AM (22 years ago)
Author:
bird
Message:

#416: Check .a libraries too, they might be OMF you know. This makes life easier when porting stuff like doxygen.

File:
1 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r454 r455  
    3434#include <emx/getopt.h>
    3535#include <alloca.h>
     36#include <sys/omflib.h>
    3637#include "defs.h"
    3738
     
    425426                    szFilename[cchPath++] = '\\';
    426427
     428                  /* Files we're looking for:
     429                   *    1. file with .lib extention.
     430                   *    2. file with .lib extention and lib prefix.
     431                   *    3. file with .a extention which is an OMF library.
     432                   *    4. file with .a extention and lib prefix which is an OMF library.
     433                   */
    427434                  strcat(strcpy(szFilename + cchPath, list->name), ".lib");
    428435                  fFound = !stat(szFilename, &s);
     
    431438                      strcat(strcpy(strcpy(szFilename + cchPath, "lib") + 3, list->name), ".lib");
    432439                      fFound = !stat(szFilename, &s);
     440                      if (!fFound)
     441                        {
     442                          strcat(strcpy(szFilename + cchPath, list->name), ".a");
     443                          fFound = !stat(szFilename, &s);
     444                          if (!fFound)
     445                            {
     446                              strcat(strcpy(strcpy(szFilename + cchPath, "lib") + 3, list->name), ".a");
     447                              fFound = !stat(szFilename, &s);
     448                            }
     449                          /*
     450                           * Is this an OMF library?
     451                           * We will open it hand do some verification of the LIBHDR.
     452                           */
     453                          if (fFound)
     454                            {
     455                              FILE *pFile = fopen(szFilename, "rb");
     456                              fFound = 0;
     457                              if (pFile)
     458                                {
     459                                  #pragma pack(1)
     460                                  struct
     461                                  {
     462                                      byte rec_type;
     463                                      word rec_len;
     464                                      dword dict_offset;
     465                                      word dict_blocks;
     466                                      byte flags;
     467                                  } libhdr;
     468                                  #pragma pack()
     469                                  if (  fread(&libhdr, 1, sizeof(libhdr), pFile) == sizeof(libhdr)
     470                                      && libhdr.rec_type == LIBHDR
     471                                      && libhdr.flags <= 1 /* ASSUME only first bit is used... */
     472                                      )
     473                                    {
     474                                      int page_size = libhdr.rec_len + 3;
     475                                      if (   page_size >= 16
     476                                          && page_size <= 32768
     477                                          && !(page_size & (page_size - 1)) != 0)
     478                                          fFound = 1;
     479                                    }
     480                                  fclose(pFile);
     481                                }
     482                            }
     483                        }
    433484                    }
    434485                }
     
    437488
    438489      put_arg (fFound ? szFilename : list->name, TRUE, TRUE);
     490//fprintf(stderr, "%s -> %s\n", list->name, fFound ? szFilename : strpbrk(list->name,     ":\\/.") ? "not searched for" : "not found");
    439491    } /* foreach list entry */
    440492}
     
    541593  char tmp[512], *t;
    542594  static char emxshell [200];
     595
     596  /* Get options from response files (@filename) and wildcard (*.o) on the command. */
     597  _response (&argc, &argv);
     598  _wildcard (&argc, &argv);
    543599
    544600  /* Drop EMXSHELL since it can point to a Unix shell which is bad for us */
Note: See TracChangeset for help on using the changeset viewer.