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 / opendir.c < prev    next >
C/C++ Source or Header  |  1988-10-02  |  657b  |  30 lines

  1. /*
  2.  * BSD/Unix expansion library for Amiga.
  3.  *
  4.  * opendir() -- system independent directory code
  5.  */
  6.  
  7. #include "dir.h"
  8.  
  9. DIR *
  10. opendir(dirname)
  11.    char *dirname;
  12. {
  13.     register DIR    *my_dir, *AllocMem(/* int, int */) ;
  14.     struct FileLock    *Lock(/* char *, int */), *CurrentDir(/* struct FileLock * */) ;
  15.  
  16.     if ((my_dir = AllocMem(sizeof(DIR), 0)) == NULL)
  17.         return NULL ;
  18.  
  19.     if (((my_dir->d_lock = Lock(dirname, ACCESS_READ)) == NULL)
  20.         /* If we can't examine it */
  21.         ||  !Examine(my_dir->d_lock, &(my_dir->d_info))
  22.         /* Or it's not a directory */
  23.         ||  (my_dir->d_info.fib_DirEntryType < 0))
  24.     {
  25.         FreeMem(my_dir, sizeof(DIR)) ;
  26.         return NULL ;
  27.     }
  28.     return my_dir ;
  29. }
  30.