--- a/DirectoryStream.st Fri Sep 19 01:03:17 1997 +0200
+++ b/DirectoryStream.st Sat Sep 20 23:06:35 1997 +0200
@@ -171,15 +171,15 @@
struct dirent {
char d_name[100]; /* File name */
int d_namlen;
- int vms_verscount; /* Number of versions */
- int vms_versions[20]; /* Version numbers */
+ int vms_verscount; /* Number of versions */
+ int vms_versions[20]; /* Version numbers */
};
/* Handle returned by opendir(), used by the other routines. You
* are not supposed to care what's inside this structure. */
typedef struct _dirdesc {
long context;
- int vms_wantversions;
+ int vms_wantversions;
char *pattern;
struct dirent entry;
struct dsc$descriptor_s pat;
@@ -327,12 +327,12 @@
*/
struct dirent *
readdir(dd)
- DIR *dd;
+ DIR *dd;
{
- struct dsc$descriptor_s res;
- char *p;
- char buff[sizeof dd->entry.d_name];
- int i;
+ struct dsc$descriptor_s res;
+ char *p;
+ char buff[sizeof dd->entry.d_name];
+ int i;
/* Set up result descriptor, and get next file. */
res.dsc$a_pointer = buff;
@@ -373,7 +373,7 @@
*/
long
telldir(dd)
- DIR *dd;
+ DIR *dd;
{
return dd->context;
}
@@ -383,8 +383,8 @@
*/
void
seekdir(dd, pos)
- DIR *dd;
- long pos;
+ DIR *dd;
+ long pos;
{
dd->context = pos;
}
@@ -417,9 +417,15 @@
Instances of DirectoryStream allow reading a file-directory,
as if it was a stream of filenames.
Basically, its an interface to opendir, readdir and closedir.
+ Notice:
+ DirectoryStream is an ST/X special;
+ for portability, we recommend the use of Filename protocol.
[author:]
Claus Gittinger
+
+ [see also:]
+ Filename
"
! !
@@ -457,8 +463,15 @@
__BEGIN_INTERRUPTABLE__
do {
- errno = 0;
- dp = readdir(d);
+ do {
+ errno = 0;
+ dp = readdir(d);
+ /*
+ * for compatibility with ST-80,
+ * skip entries for '.' and '..'.
+ * If wanted, these must be added synthetically.
+ */
+ } while (dp && ((strcmp(dp->d_name, ".")==0) || (strcmp(dp->d_name, "..")==0)));
} while ((dp == NULL) && (errno == EINTR));
__END_INTERRUPTABLE__
@@ -633,7 +646,7 @@
"test for if the unread portion of the directory stream is empty.
This query changes the readPointer of the DirectoryStream"
- |pos entry|
+ |entry|
[self atEnd] whileFalse:[
entry := self nextLine.
@@ -655,5 +668,5 @@
!DirectoryStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.38 1997-09-18 17:29:19 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.39 1997-09-20 21:06:35 cg Exp $'
! !