home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 December / simtel1292_SIMTEL_1292_Walnut_Creek.iso / msdos / c / du.arc / MSD_DIR.H < prev    next >
C/C++ Source or Header  |  1987-12-26  |  2KB  |  57 lines

  1. /*
  2.  * @(#)msd_dir.h 1.4 87/11/06    Public Domain.
  3.  *
  4.  *  A public domain implementation of BSD directory routines for
  5.  *  MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
  6.  *  August 1897
  7.  *
  8.  *  Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks
  9.  *  and returns 2 more pieces of information - file size & attribute.
  10.  *  Plus a little reshuffling of some #define's positions    December 1987
  11.  */
  12.  
  13. #define    rewinddir(dirp)    seekdir(dirp, 0L)
  14.  
  15. #define    MAXNAMLEN    12
  16.  
  17. #ifndef    MAXPATHLEN
  18. # define    MAXPATHLEN    255
  19. #endif    /* MAXPATHLEN */
  20.  
  21. /* attribute stuff */
  22. #define    A_RONLY        0x01
  23. #define    A_HIDDEN    0x02
  24. #define    A_SYSTEM    0x04
  25. #define    A_LABEL        0x08
  26. #define    A_DIR        0x10
  27. #define    A_ARCHIVE    0x20
  28.  
  29. struct direct {
  30.     ino_t    d_ino;            /* a bit of a farce */
  31.     int    d_reclen;        /* more farce */
  32.     int    d_namlen;        /* length of d_name */
  33.     char    d_name[MAXNAMLEN + 1];        /* garentee null termination */
  34.     char    d_attribute;
  35.     unsigned long    d_size;
  36. };
  37.  
  38. struct _dircontents {
  39.     char    *_d_entry;
  40.     char    d_attribute;
  41.     unsigned long    d_size;
  42.     struct _dircontents    *_d_next;
  43. };
  44.  
  45. typedef struct _dirdesc {
  46.     int        dd_id;    /* uniquely identify each open directory */
  47.     long        dd_loc;    /* where we are in directory entry is this */
  48.     struct _dircontents    *dd_contents;    /* pointer to contents of dir */
  49.     struct _dircontents    *dd_cp;    /* pointer to current position */
  50. } DIR;
  51.  
  52. extern    DIR        *opendir();
  53. extern    struct direct    *readdir();
  54. extern    void        seekdir();
  55. extern    long        telldir();
  56. extern    void        closedir();
  57.