home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / language / perl_419 / atari.dif next >
Encoding:
Text File  |  1993-10-23  |  4.5 KB  |  165 lines

  1. *** /net/muncher/home2/dovich/gnu/gdbm-1.5/gdbmreorg.c    Thu Feb 28 19:58:30 1991
  2. --- gdbmreorg.c    Sat Sep 28 00:00:11 1991
  3. ***************
  4. *** 149,154 ****
  5. --- 149,155 ----
  6.   
  7.       /* Move the new file to old name. */
  8.   
  9. + #ifndef atarist    /* on the atari you cannot rename before closing */
  10.     if (rename (new_name, dbf->name) != 0)
  11.       {
  12.         gdbm_errno = GDBM_REORGANIZE_FAILED;
  13. ***************
  14. *** 155,164 ****
  15. --- 156,183 ----
  16.         gdbm_close (new_dbf);
  17.         return -1;
  18.       }
  19. + #endif
  20.   
  21.     /* Fix up DBF to have the correct information for the new file. */
  22.     UNLOCK_FILE(dbf);
  23.     close (dbf->desc);
  24. + #ifdef atarist
  25. +   close(new_dbf->desc);
  26. +   if (rename (new_name, dbf->name) != 0)
  27. +     {
  28. +       gdbm_errno = GDBM_REORGANIZE_FAILED;
  29. +       gdbm_close (new_dbf);
  30. +       return -1;
  31. +     }
  32. +   if((new_dbf->desc = open(dbf->name, O_RDWR)) < 0)
  33. +     {
  34. +       gdbm_errno = GDBM_REORGANIZE_FAILED;
  35. +       gdbm_close (new_dbf);
  36. +       return -1;
  37. +     }
  38. +     lseek(new_dbf->desc, 0L, SEEK_END);
  39. + #endif
  40.     free (dbf->header);
  41.     free (dbf->dir);
  42.     for (index = 0; index < CACHE_SIZE; index++)
  43. *** /net/muncher/home2/dovich/gnu/gdbm-1.5/systems.h    Thu Feb 28 19:58:34 1991
  44. --- systems.h    Sat Sep 28 00:12:08 1991
  45. ***************
  46. *** 82,97 ****
  47.   /* Get string definitions. */
  48.   #include <string.h>
  49.   #define _HAVE_STRING
  50. - #endif
  51.   
  52.   /* Sys V does not have a truncate call, how primitive. */
  53.   #define TRUNCATE(dbf) close( open (dbf->name, O_RDWR|O_TRUNC, mode));
  54.   
  55.   
  56.   /*      End of System V changes and defines.      */
  57.   /**************************************************/
  58.   
  59.   
  60.   
  61.   /* Alloca is builtin in gcc.  Use the builtin alloca if compiled with gcc. */
  62.   #ifdef __GNUC__
  63. --- 82,142 ----
  64.   /* Get string definitions. */
  65.   #include <string.h>
  66.   #define _HAVE_STRING
  67.   
  68.   /* Sys V does not have a truncate call, how primitive. */
  69.   #define TRUNCATE(dbf) close( open (dbf->name, O_RDWR|O_TRUNC, mode));
  70.   
  71. + #endif
  72.   
  73.   /*      End of System V changes and defines.      */
  74.   /**************************************************/
  75.   
  76.   
  77. + /*         AtariST-gcc changes and defines.       */
  78. + /**************************************************/
  79. + #ifdef atarist
  80. + /* File seeking needs L_SET defined .*/
  81. + #include <fcntl.h>
  82. + #include <unistd.h>
  83. + #define L_SET SEEK_SET
  84. + /* Some files need fcntl.h for locking. pretend with successes always*/
  85. + #define UNLOCK_FILE(dbf) (0)
  86. + #define READLOCK_FILE(dbf) { lock_val = 0; }
  87. + #define WRITELOCK_FILE(dbf) { lock_val = 0; }
  88. + /* Send bcmp to the right place. */
  89. + #include <memory.h>
  90. + /* atariST does not have fsync. Things are always sync'ed so pretend */
  91. + #define fsync(f) (0)
  92. + /* Get string definitions. */
  93. + #include <string.h>
  94. + #define _HAVE_STRING
  95. + /* atariST does not have a truncate call, how primitive. */
  96. + /* for this application, (truncate to zero length) the following will suffice */
  97. + #define TRUNCATE(dbf) \
  98. +  {                              \
  99. +     (void)close(dbf->desc);                  \
  100. +     (void)remove(dbf->name);                   \
  101. +     dbf->desc = open (dbf->name, O_RDWR|O_CREAT, mode);   \
  102. +     if(dbf->desc <  0)                       \
  103. +     {                              \
  104. +     free(dbf->name);                  \
  105. +     free(dbf);                      \
  106. +         gdbm_errno = GDBM_FILE_OPEN_ERROR;          \
  107. +         return NULL;                      \
  108. +     }                              \
  109. +  }
  110. + #endif
  111. + /*      End of AtariST-gcc changes and defines.      */
  112. + /**************************************************/
  113.   
  114.   /* Alloca is builtin in gcc.  Use the builtin alloca if compiled with gcc. */
  115.   #ifdef __GNUC__
  116. ***************
  117. *** 113,119 ****
  118. --- 158,166 ----
  119.   #endif
  120.   
  121.   /* Malloc definition. */
  122. + #if !__STDC__
  123.   extern char *malloc();
  124. + #endif
  125.   
  126.   /* String definitions. */
  127.   #ifndef _HAVE_STRING
  128. *** /net/muncher/home2/dovich/gnu/gdbm-1.5/testgdbm.c    Thu Feb 28 19:58:36 1991
  129. --- testgdbm.c    Fri Sep 27 23:28:53 1991
  130. ***************
  131. *** 188,198 ****
  132.     data_data.dptr = data_line;
  133.   
  134.     if (reader)
  135. !     gdbm_file = gdbm_open (file_name, 512, GDBM_READER, 00664, NULL);
  136.     else if (newdb)
  137. !     gdbm_file = gdbm_open (file_name, 512, GDBM_NEWDB, 00664, NULL);
  138.     else
  139. !     gdbm_file = gdbm_open (file_name, 512, GDBM_WRCREAT, 00664, NULL);
  140.     if (gdbm_file == NULL)
  141.       {
  142.         if (gdbm_errno != GDBM_CANT_BE_WRITER)
  143. --- 188,198 ----
  144.     data_data.dptr = data_line;
  145.   
  146.     if (reader)
  147. !     gdbm_file = gdbm_open (file_name, 512, GDBM_READER, 0664, NULL);
  148.     else if (newdb)
  149. !     gdbm_file = gdbm_open (file_name, 512, GDBM_NEWDB, 0664, NULL);
  150.     else
  151. !     gdbm_file = gdbm_open (file_name, 512, GDBM_WRCREAT, 0664, NULL);
  152.     if (gdbm_file == NULL)
  153.       {
  154.         if (gdbm_errno != GDBM_CANT_BE_WRITER)
  155.