home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d156 / flex.lha / Flex / Flex2 / gnu.lib.src / seekdir.c < prev    next >
C/C++ Source or Header  |  1988-10-02  |  728b  |  29 lines

  1. /*
  2.  * BSD/Unix expansion library for Amiga.
  3.  *
  4.  * seekdir() -- system independent directory code
  5.  */
  6.  
  7. #include "dir.h"
  8.  
  9. /*
  10.  * telldir and seekdir don't work quite right. The problem is that you have
  11.  * to save more than a long's worth of stuff to indicate position, and it's
  12.  * socially unacceptable to alloc stuff that you don't free later under
  13.  * AmigaDOS. So we fake it - you get one level of seek, and dat's all.
  14.  * As of now, these things are untested.
  15.  */
  16.  
  17. #define DIR_SEEK_RETURN        ((long) 1)    /* Not 0! */
  18.  
  19. void
  20. seekdir(my_dir, where)
  21.    DIR *my_dir;
  22.    long where;
  23. {
  24.     if (where == DIR_SEEK_RETURN)
  25.         my_dir->d_info = my_dir->d_seek ;
  26.     else    /* Makes the next readdir fail */
  27.         setmem((char *) my_dir, sizeof(DIR), 0) ;
  28. }
  29.