Changeset 22259

Show
Ignore:
Timestamp:
12.06.2010 23:33:27 (9 years ago)
Author:
davidb
Message:

Tie Makefile and source code in with -DMSDOS so MinGW/MSys compilation works with GDBM

Location:
main/trunk/greenstone2/common-src/packages/gdbm/gdbm-1.8.3
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/common-src/packages/gdbm/gdbm-1.8.3/Makefile.in

    r18345 r22259  
    2929CFLAGS = @CFLAGS@ @COMPAT32BITFLAGS@ 
    3030LDFLAGS = @LDFLAGS@ @COMPAT32BITFLAGS@ 
     31 
     32ifeq ($(GSDLOS), "windows") 
     33  # Let MinGW/MSys tap into Windows code for GDBM 
     34  CFLAGS += -DMSDOS 
     35endif 
    3136 
    3237# Common prefix for installation directories 
  • main/trunk/greenstone2/common-src/packages/gdbm/gdbm-1.8.3/dbminit.c

    r18019 r22259  
    7676 
    7777  /* Try to open the file as a writer.  DBM never created a file. */ 
     78#ifdef MSDOS 
     79  /* Not clear if final argument for Windows should be to obtain a 
     80     file lock or not.  Play it safe for now and ask for a lock 
     81  */ 
     82  _gdbm_file = gdbm_open (pag_file, 0, GDBM_WRITER, 0, NULL, TRUE); 
     83#else 
    7884  _gdbm_file = gdbm_open (pag_file, 0, GDBM_WRITER, 0, NULL); 
     85#endif 
    7986 
    8087  /* If it was not opened, try opening it as a reader. */ 
    8188  if (_gdbm_file == NULL) 
    8289    { 
     90#ifdef MSDOS 
     91      _gdbm_file = gdbm_open (pag_file, 0, GDBM_READER, 0, NULL, TRUE); 
     92#else 
    8393      _gdbm_file = gdbm_open (pag_file, 0, GDBM_READER, 0, NULL); 
    84    
     94#endif   
    8595      /* Did we successfully open the file? */ 
    8696      if (_gdbm_file == NULL) 
  • main/trunk/greenstone2/common-src/packages/gdbm/gdbm-1.8.3/dbmopen.c

    r18019 r22259  
    5454 
    5555gdbm_file_info * 
     56#ifdef MSDOS 
     57dbm_open (file, flags, mode, need_filelock) 
     58#else 
    5659dbm_open (file, flags, mode) 
     60#endif 
    5761     char *file; 
    5862     int flags; 
    5963     int mode; 
     64#ifdef MSDOS 
     65     int need_filelock; 
     66#endif 
     67 
    6068{ 
    6169  char* pag_file;       /* Used to construct "file.pag". */ 
     
    8492  if (flags == O_RDONLY) 
    8593    { 
     94#ifdef MSDOS 
     95      temp_dbf = gdbm_open (pag_file, 0, GDBM_READER, 0, NULL, need_filelock); 
     96#else 
    8697      temp_dbf = gdbm_open (pag_file, 0, GDBM_READER, 0, NULL); 
     98#endif 
    8799    } 
    88100  else if (flags == (O_RDWR | O_CREAT)) 
    89101    { 
     102#ifdef MSDOS 
     103      temp_dbf = gdbm_open (pag_file, 0, GDBM_WRCREAT, mode, NULL, need_filelock); 
     104#else 
    90105      temp_dbf = gdbm_open (pag_file, 0, GDBM_WRCREAT, mode, NULL); 
     106#endif 
    91107    } 
    92108  else if ( (flags & O_TRUNC) == O_TRUNC) 
    93109    { 
     110#ifdef MSDOS 
     111      temp_dbf = gdbm_open (pag_file, 0, GDBM_NEWDB, mode, NULL, need_filelock); 
     112#else 
    94113      temp_dbf = gdbm_open (pag_file, 0, GDBM_NEWDB, mode, NULL); 
     114#endif 
    95115    } 
    96116  else 
    97117    { 
     118#ifdef MSDOS 
     119      temp_dbf = gdbm_open (pag_file, 0, GDBM_WRITER, 0, NULL, need_filelock); 
     120#else 
    98121      temp_dbf = gdbm_open (pag_file, 0, GDBM_WRITER, 0, NULL); 
     122#endif 
    99123    } 
    100124 
  • main/trunk/greenstone2/common-src/packages/gdbm/gdbm-1.8.3/gdbmreorg.c

    r18074 r22259  
    113113  /* Get the mode for the old file and open the new database. */ 
    114114  fstat (dbf->desc, &fileinfo); 
     115#ifdef MSDOS 
     116  /* Not clear if final argument for Windows should be to obtain a 
     117     file lock or not.  Play it safe for now and ask for a lock 
     118  */ 
     119  new_dbf = gdbm_open (new_name, dbf->header->block_size, GDBM_WRCREAT, 
     120               fileinfo.st_mode, dbf->fatal_err,dbf->need_filelock); 
     121#else 
    115122  new_dbf = gdbm_open (new_name, dbf->header->block_size, GDBM_WRCREAT, 
    116123               fileinfo.st_mode, dbf->fatal_err); 
     124#endif 
    117125 
    118126  if (new_dbf == NULL)