home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / h.z / DIRECT.H < prev    next >
C/C++ Source or Header  |  1996-09-19  |  4KB  |  122 lines

  1. /*
  2.  *  direct.h    Defines the types and structures used by the directory routines
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5.  */
  6. #ifndef _DIRECT_H_INCLUDED
  7. #define _DIRECT_H_INCLUDED
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. #ifndef _COMDEF_H_INCLUDED
  13.  #include <_comdef.h>
  14. #endif
  15.  
  16. #if defined(_M_IX86)
  17.   #pragma pack(__push,1);
  18. #else
  19.   #pragma pack(__push,8);
  20. #endif
  21.  
  22. #ifndef _WCHAR_T_DEFINED
  23. #define _WCHAR_T_DEFINED
  24. #define _WCHAR_T_DEFINED_
  25. #ifdef __cplusplus
  26. typedef long char wchar_t;
  27. #else
  28. typedef unsigned short wchar_t;
  29. #endif
  30. #endif
  31.  
  32. #ifndef __TYPES_H_INCLUDED
  33.  #include <sys/types.h>
  34. #endif
  35.  
  36. #if defined(__OS2__) || defined(__NT__)
  37. #define NAME_MAX    255        /* maximum filename for HPFS or NTFS */
  38. #else
  39. #define NAME_MAX    12        /* 8 chars + '.' +  3 chars */
  40. #endif
  41.  
  42. struct _wdirent {
  43.     char           d_dta[21];    /* disk transfer area */
  44.     char           d_attr;         /* file's attribute */
  45.     unsigned short int d_time;        /* file's time */
  46.     unsigned short int d_date;        /* file's date */
  47.     long           d_size;         /* file's size */
  48.     wchar_t           d_name[NAME_MAX+1];/* file's name */
  49.     unsigned short     d_ino;        /* serial number (not used) */
  50.     char           d_first;        /* flag for 1st time */
  51.     wchar_t *           d_openpath;    /* path specified to _wopendir */
  52. };
  53.  
  54. struct dirent {
  55.     char           d_dta[21];    /* disk transfer area */
  56.     char           d_attr;         /* file's attribute */
  57.     unsigned short int d_time;        /* file's time */
  58.     unsigned short int d_date;        /* file's date */
  59.     long           d_size;         /* file's size */
  60.     char           d_name[NAME_MAX+1];/* file's name */
  61.     unsigned short     d_ino;        /* serial number (not used) */
  62.     char           d_first;        /* flag for 1st time */
  63.     char *           d_openpath;    /* path specified to opendir */
  64. };
  65. typedef struct dirent    DIR;
  66.  
  67. /* File attribute constants for d_attr field */
  68.  
  69. #define _A_NORMAL    0x00    /* Normal file - read/write permitted */
  70. #define _A_RDONLY    0x01    /* Read-only file */
  71. #define _A_HIDDEN    0x02    /* Hidden file */
  72. #define _A_SYSTEM    0x04    /* System file */
  73. #define _A_VOLID    0x08    /* Volume-ID entry */
  74. #define _A_SUBDIR    0x10    /* Subdirectory */
  75. #define _A_ARCH     0x20    /* Archive file */
  76.  
  77. #ifndef _DISKFREE_T_DEFINED
  78. #define _DISKFREE_T_DEFINED
  79. #define _DISKFREE_T_DEFINED_
  80. struct _diskfree_t {
  81.         unsigned total_clusters;
  82.         unsigned avail_clusters;
  83.         unsigned sectors_per_cluster;
  84.         unsigned bytes_per_sector;
  85. };
  86. #define diskfree_t _diskfree_t
  87. #endif
  88.  
  89. _WCRTLINK extern int          chdir( const char *__path );
  90. _WCRTLINK extern int          closedir( struct dirent * );
  91. _WCRTLINK extern char *          getcwd( char *__buf, size_t __size );
  92. _WCRTLINK extern char *          _getcwd( char *__buf, size_t __size );
  93. _WCRTLINK extern char *          _getdcwd( int __drive, char *__buffer,
  94.                         size_t __maxlen ); 
  95. _WCRTLINK extern unsigned      _getdrive( void );
  96. _WCRTLINK extern unsigned      _getdiskfree( unsigned __drive,
  97.                         struct _diskfree_t 
  98.                         *__diskspace);
  99. _WCRTLINK extern int          mkdir( const char *__path );
  100. _WCRTLINK extern int          _mkdir( const char *__path );
  101. _WCRTLINK extern struct dirent *  opendir( const char * );
  102. _WCRTLINK extern struct dirent *  readdir( struct dirent * );
  103. _WCRTLINK extern void          rewinddir( struct dirent * );
  104. _WCRTLINK extern int          rmdir( const char *__path );
  105.  
  106. _WCRTLINK extern int          _wchdir( const wchar_t *__path );
  107. _WCRTLINK extern int          _wclosedir( struct _wdirent * );
  108. _WCRTLINK extern wchar_t *      _wgetcwd( wchar_t *__buf, size_t __size );
  109. _WCRTLINK extern wchar_t *      _wgetdcwd( int __drive, wchar_t *__buffer,
  110.                          size_t __maxlen ); 
  111. _WCRTLINK extern int          _wmkdir( const wchar_t *__path );
  112. _WCRTLINK extern struct _wdirent *_wopendir( const wchar_t * );
  113. _WCRTLINK extern struct _wdirent *_wreaddir( struct _wdirent * );
  114. _WCRTLINK extern void          _wrewinddir( struct _wdirent * );
  115. _WCRTLINK extern int          _wrmdir( const wchar_t *__path );
  116.  
  117. #pragma pack(__pop);
  118. #ifdef __cplusplus
  119. };
  120. #endif
  121. #endif
  122.