httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Havard" <bri...@kheldar.apana.org.au>
Subject APR: directory API
Date Wed, 12 May 1999 15:14:13 GMT
Now that the dust has settled (I hope) over the ap/apr argument I'd like to
bring up the problem I still have with the directory API.

The problem is that ap_readdir() still returns a dirent *. It may be hidden
under several layers of typedef but that's still what it is and still has to
be treated as such by the API user. IE you have to access the file name as
ent->d_name. The test program even uses d_ino which is far from portable.

I presented what I think is a better solution a while back in message
<199904110149.LAA11629@silk.apana.org.au> and I'd be happy to implement it
for the platforms I have access to (OS/2, Unix and Win32) if it's generally
approved of. Not only is it fully platform independent but provides more
possibilities for exploiting the features of of each platform. I also think
it's cleaner in that there's only one data structure for the user to keep
track of instead of two.

It looked something like this:

apr_dir_t *apr_opendir(const char *);
apr_status_t apr_closedir(apr_dir_t *);
apr_status_t apr_readdir(apr_dir_t *);
apr_ssize_t apr_dir_entry_size(apr_dir_t *);
apr_time_t apr_dir_entry_mtime(apr_dir_t *);
apr_status_t apr_rewinddir(apr_dir_t *);

Note no apr_dirent_t at all. It would be use like:

thisdir = apr_opendir("foo/bar");
if (thisdir) {
    while(apr_readdir(thisdir) == APR_SUCCESS) {
        printf("%s %d\n", thisdir->entryname, apr_dir_entry_size(thisdir));
    }
}


--
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Mime
View raw message