Advanced Strategic Command
ndir.h
Go to the documentation of this file.
1 /* ndir.c - portable directory routines
2  Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 1, or (at your option)
7  any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details. */
13 
14 /* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4
15  87/11/06. A public domain implementation of BSD directory routines
16  for MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
17  August 1897 */
18 
19 /*
20  * Modified for WinCvs : Alexandre Parenteau <aubonbeurre@geocities.com> --- March 1998
21  */
22 
23 #if _MSC_VER > 1000
24 #pragma once
25 #endif
26 
27 #ifndef _NDIR_H
28 #define _NDIR_H
29 
30 #include <sys/types.h> /* ino_t definition */
31 
32 #define rewinddir(dirp) seekdir(dirp, 0L)
33 
34 /* 255 is said to be big enough for Windows NT. The more elegant
35  solution would be declaring d_name as one byte long and allocating
36  it to the actual size needed. */
37 #define MAXNAMLEN 255
38 
39 struct direct
40 {
41  ino_t d_ino; /* a bit of a farce */
42  int d_reclen; /* more farce */
43  int d_namlen; /* length of d_name */
44  char d_name[MAXNAMLEN + 1]; /* garentee null termination */
45 };
46 
48 {
49  char *_d_entry;
51 };
52 
53 typedef struct _dirdesc
54 {
55  int dd_id; /* uniquely identify each open directory */
56  long dd_loc; /* where we are in directory entry is this */
57  struct _dircontents *dd_contents; /* pointer to contents of dir */
58  struct _dircontents *dd_cp; /* pointer to current position */
59 } DIR;
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif /* __cplusplus */
64 
65 extern void seekdir (DIR *, long);
66 extern long telldir (DIR *);
67 extern DIR *opendir (const char *);
68 extern void closedir (DIR *);
69 extern struct direct *readdir (DIR *);
70 
71 #ifdef __cplusplus
72 }
73 #endif /* __cplusplus */
74 
75 
76 /*
77  * Local Variables:
78  * mode:C
79  * ChangeLog:ChangeLog
80  * compile-command:make
81  * End:
82  */
83 #endif /* _NDIR_H */
#define MAXNAMLEN
Definition: ndir.h:37
Definition: ndir.h:39
struct _dircontents * _d_next
Definition: ndir.h:50
ino_t d_ino
Definition: ndir.h:41
DIR * opendir(const char *)
struct _dirdesc DIR
long telldir(DIR *)
struct direct * readdir(DIR *)
Definition: ndir.h:53
char d_name[MAXNAMLEN+1]
Definition: ndir.h:44
struct _dircontents * dd_contents
Definition: ndir.h:57
int d_reclen
Definition: ndir.h:42
int d_namlen
Definition: ndir.h:43
int dd_id
Definition: ndir.h:55
void seekdir(DIR *, long)
char * _d_entry
Definition: ndir.h:49
struct _dircontents * dd_cp
Definition: ndir.h:58
long dd_loc
Definition: ndir.h:56
void closedir(DIR *)