home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_c / flex.lzh / FLEX / FLEX2 / GNU.LIB.SRC / SEEKDIR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-16  |  728 b   |  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.