home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / snip1292.zip / DIRENT.H < prev    next >
C/C++ Source or Header  |  1992-02-22  |  2KB  |  76 lines

  1. /*
  2. **  DIRENT.H - Posix compliant header
  3. **
  4. **  Original Copyright 1988-1991 by Bob Stout as part of
  5. **  the MicroFirm Function Library (MFL)
  6. **
  7. **  This subset version is functionally identical to the
  8. **  version originally published by the author in Tech Specialist
  9. **  magazine and is hereby donated to the public domain.
  10. */
  11.  
  12. #ifndef DIRENT_H
  13. #define DIRENT_H
  14.  
  15. #include <stdio.h>                      /* For FILENAME_MAX     */
  16. #include <dos.h>
  17.  
  18. #if defined(__ZTC__)
  19.  #define DSTRUCT        FIND            /* ZTC/C++              */
  20.  #define ATTRIBUTE      attribute
  21.  #define NAME           name
  22.  #pragma pack(1)
  23.  #include <direct.h>
  24. #elif defined(__TURBOC__)
  25.  #define DSTRUCT        ffblk           /* TC/C++               */
  26.  #define ATTRIBUTE      ff_attrib
  27.  #define NAME           ff_name
  28.  #include <dir.h>
  29. #else
  30.  #define DSTRUCT        find_t          /* Assume MSC/QC        */
  31.  #define ATTRIBUTE      attrib
  32.  #define NAME           name
  33.  #pragma pack(1)
  34.  #include <direct.h>
  35. #endif
  36.  
  37. #define FA_ANY 0xff
  38. #undef FA_DIREC
  39. #define FA_DIREC 0x10
  40.  
  41. /*
  42. **  Portable find first/next functions from RFIND1ST.C
  43. */
  44.  
  45. struct DSTRUCT *rfind_1st(char *, unsigned, struct DSTRUCT *);
  46. struct DSTRUCT *rfind_nxt(struct DSTRUCT *);
  47.  
  48. typedef struct
  49. {
  50.       int               dd_fd;
  51.       unsigned          dd_loc,
  52.                         dd_size;
  53.       struct DSTRUCT    dd_buf;
  54.       char              dd_dirname[FILENAME_MAX];
  55. } DOS_DIR;
  56.  
  57. DOS_DIR        *opendir(char *);
  58. int             closedir(DOS_DIR *),
  59.                 rewinddir(DOS_DIR *);
  60. struct DSTRUCT *readdir(DOS_DIR *),
  61.                *seekdir(DOS_DIR *, int, int);
  62. #define         telldir(dd) dd->loc
  63.  
  64. /*
  65. **  Other useful functions from DIRMASK.C and PATMAT.C
  66. */
  67.  
  68. int             dirmask(struct DSTRUCT *,char *,char *,unsigned,unsigned);
  69. int             patmat(const char *, const char *);
  70.  
  71. extern int DFerr;
  72.  
  73. extern DOS_DIR _DIRS[];
  74.  
  75. #endif /* DIRENT_H */
  76.