home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl502b.zip / OS2 / lib / dirent.h < prev   
C/C++ Source or Header  |  1995-04-29  |  3KB  |  103 lines

  1. #ifndef __DIRENT_H__
  2. #define __DIRENT_H__
  3. /*
  4.  * $Id: dirent.h,v 1.7 1995/04/28 22:41:18 ak Exp $
  5.  *
  6.  * @(#)msd_dir.h 1.4 87/11/06   Public Domain.
  7.  *
  8.  *  A public domain implementation of BSD directory routines for
  9.  *  MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
  10.  *  August 1897
  11.  *
  12.  *  Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks
  13.  *  and returns 2 more pieces of information - file size & attribute.
  14.  *  Plus a little reshuffling of some #define's positions    December 1987
  15.  *
  16.  *  Some modifications by Martin Junius                      02-14-89
  17.  *
  18.  *    AK900712
  19.  *    AK910410    abs_path - make absolute path
  20.  *
  21.  * $Log: dirent.h,v $
  22.  * Revision 1.7  1995/04/28  22:41:18  ak
  23.  * Cleanup. Make dirent2 layout compatible to EMX to avoid trouble
  24.  * with include-files. Moved struct defs to implementation.
  25.  *
  26.  * Revision 1.6  1993/12/08  13:59:01  edvkai
  27.  * Removed false RCSids from log.
  28.  *
  29.  * Revision 1.5  1992/09/14  12:25:45  ak
  30.  * K.U.R.'s fixes.
  31.  *
  32.  * Revision 1.4  1992/02/14  18:08:23  ak
  33.  * *** empty log message ***
  34.  *
  35.  * Revision 1.3  1992/01/03  14:19:44  ak
  36.  *
  37.  * Revision 1.2  1992/01/03  13:45:12  ak
  38.  * Zortech fixes.
  39.  *
  40.  * Revision 1.1.1.1  1991/12/12  16:10:27  ak
  41.  * Initial checkin of server source, modified to contain RCS IDs.
  42.  *
  43.  * Revision 1.1  1991/12/12  16:10:23  ak
  44.  * Initial revision
  45.  *
  46.  */
  47.  
  48. #ifdef __EMX__
  49. #include <sys/param.h>
  50. #else
  51. #include <param.h>
  52. #endif
  53.  
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif
  57.  
  58. /* attribute stuff */
  59. #ifndef A_RONLY
  60. # define A_RONLY   0x01
  61. # define A_HIDDEN  0x02
  62. # define A_SYSTEM  0x04
  63. # define A_LABEL   0x08
  64. # define A_DIR     0x10
  65. # define A_ARCHIVE 0x20
  66. #endif
  67.  
  68. struct dirent {
  69. #ifdef OS2    /* use the layout of EMX to avoid trouble */
  70.     int            d_ino;                 /* Dummy */
  71.     int            d_reclen;          /* Dummy, same as d_namlen */
  72.     int            d_namlen;              /* length of name */
  73.     char           d_name[MAXNAMLEN + 1];
  74.     unsigned long  d_size;
  75.     unsigned short d_attribute;           /* attributes (see above) */
  76.     unsigned short d_time;                /* modification time */
  77.     unsigned short d_date;                /* modification date */
  78. #else
  79.     char       d_name[MAXNAMLEN + 1]; /* garentee null termination */
  80.     char       d_attribute;          /* .. extension .. */
  81.     unsigned long  d_size;          /* .. extension .. */
  82. #endif
  83. };
  84.  
  85. typedef struct _dirdescr DIR;
  86. /* the structs do not have to be defined here */
  87.  
  88. extern DIR        *opendir(const char *);
  89. extern DIR        *openxdir(const char *, unsigned);
  90. extern struct dirent    *readdir(DIR *);
  91. extern void        seekdir(DIR *, long);
  92. extern long        telldir(DIR *);
  93. extern void         closedir(DIR *);
  94. #define            rewinddir(dirp) seekdir(dirp, 0L)
  95.  
  96. extern char *        abs_path(const char *name, char *buffer, int len);
  97.  
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101.  
  102. #endif
  103.