home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume6 / glib / part01 / amigadir.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-14  |  1.8 KB  |  59 lines

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