Debian Codegraph @

os2/os2zip.h

raw
1 /*
2 * @(#) 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 1987
7 *
8 * Ported to OS/2 by Kai Uwe Rommel
9 * Addition of other OS/2 file system specific code
10 * Placed into the public domain
11 */
12
13
14 #define MAXNAMLEN 256
15 #define MAXPATHLEN 256
16
17 #define _A_RONLY 0x01
18 #define _A_HIDDEN 0x02
19 #define _A_SYSTEM 0x04
20 #define _A_VOLID 0x08
21 #define _A_DIR 0x10
22 #define _A_ARCHIVE 0x20
23
24
25 struct dirent
26 {
27 ino_t d_ino; /* a bit of a farce */
28 int d_reclen; /* more farce */
29 int d_namlen; /* length of d_name */
30 char d_name[MAXNAMLEN + 1]; /* null terminated */
31 /* nonstandard fields */
32 long d_size; /* size in bytes */
33 unsigned d_mode; /* DOS or OS/2 file attributes */
34 unsigned d_time;
35 unsigned d_date;
36 };
37
38 /* The fields d_size and d_mode are extensions by me (Kai Uwe Rommel).
39 * The find_first and find_next calls deliver this data without any extra cost.
40 * If this data is needed, these fields save a lot of extra calls to stat()
41 * (each stat() again performs a find_first call !).
42 */
43
44 struct _dircontents
45 {
46 char *_d_entry;
47 long _d_size;
48 unsigned _d_mode, _d_time, _d_date;
49 struct _dircontents *_d_next;
50 };
51
52 typedef struct _dirdesc
53 {
54 int dd_id; /* uniquely identify each open directory */
55 long dd_loc; /* where we are in directory entry is this */
56 struct _dircontents *dd_contents; /* pointer to contents of dir */
57 struct _dircontents *dd_cp; /* pointer to current position */
58 }
59 DIR;
60
61
62 extern DIR *opendir(const char *);
63 extern struct dirent *readdir(DIR *);
64 extern void seekdir(DIR *, long);
65 extern long telldir(DIR *);
66 extern void closedir(DIR *);
67 #define rewinddir(dirp) seekdir(dirp, 0L)
68
69 int GetFileMode(char *name);
70 ulg GetFileTime(char *name);
71 void SetFileTime(char *path, ulg stamp);
72 char *getVolumeLabel(int drive, unsigned long *time, unsigned long *mode,
73 time_t *utim);
74
75 int IsFileNameValid(char *name);
76 int IsFileSystemFAT(char *dir);
77 void ChangeNameForFAT(char *name);
78
79 char *GetLongNameEA(const char *name);
80 char *GetLongPathEA(const char *name);
81 void GetEAs(char *name, char **bufptr, size_t *size,
82 char **cbufptr, size_t *csize);
83
84 char *StringLower(char *);