home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff281.lzh / Diff / dir.h < prev    next >
C/C++ Source or Header  |  1989-11-20  |  2KB  |  57 lines

  1. #ifndef DIR_H
  2. #define DIR_H
  3.  
  4. #ifndef    EXEC_TYPES_H
  5. #include "exec/types.h"
  6. #endif
  7.  
  8. #ifndef    LIBRARIES_DOS_H
  9. #include "libraries/dos.h"
  10. #endif
  11.  
  12. #ifndef    LIBRARIES_DOSEXTENS_H
  13. #include "libraries/dosextens.h"
  14. #endif
  15. /*
  16.  * MAXNAMELEN is the maximum length a file name can be. The direct structure
  17.  * is lifted form 4BSD, and has not been changed so that code which uses
  18.  * it will be compatable with 4BSD code. d_ino and d_reclen are unused,
  19.  * and will probably be set to some non-zero value.
  20.  */
  21. #define    MAXNAMLEN    31        /* AmigaDOS file max length */
  22.  
  23. struct    direct {
  24.     ULONG    d_ino ;            /* unused - there for compatability */
  25.     USHORT    d_reclen ;        /* ditto */
  26.     USHORT    d_namlen ;        /* length of string in d_name */
  27.     char    d_name[MAXNAMLEN + 1] ;    /* name must be no longer than this */
  28. };
  29. /*
  30.  * The DIRSIZ macro gives the minimum record length which will hold
  31.  * the directory entry.  This requires the amount of space in struct direct
  32.  * without the d_name field, plus enough space for the name with a terminating
  33.  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  34.  */
  35.  
  36. #undef DIRSIZ
  37. #define DIRSIZ(dp) \
  38.     ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp) -> d_namlen+1 + 3) &~ 3))
  39. /*
  40.  * The DIR structure holds the things that AmigaDOS needs to know about
  41.  * a file to keep track of where it is and what it's doing.
  42.  */
  43.  
  44. typedef struct {
  45.     struct FileInfoBlock    d_info ,    /* Default info block */
  46.                 d_seek ;    /* Info block for seeks */
  47.     struct FileLock        *d_lock ;    /* Lock on directory */
  48.     } DIR ;
  49.     
  50. extern    DIR *opendir(char *) ;
  51. extern    struct direct *readdir(DIR *) ;
  52. extern    long telldir(DIR *) ;
  53. extern    void seekdir(DIR *, long) ;
  54. extern    void rewinddir(DIR *) ;
  55. extern    void closedir(DIR *) ;
  56. #endif    DIR_H
  57.