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 Re: APR: directory API
Date Thu, 13 May 1999 01:38:18 GMT
On Wed, 12 May 1999 11:54:36 -0400 (EDT), Ryan Bloom wrote:

>The Q:
>When the user does an ap_opendir, does that get the first entry in the
>directory.  I think it should personnaly, unless somebody can provide a
>good reason why it shouldn't.
>
>> thisdir = apr_opendir("foo/bar");
>> if (thisdir) {
>>     while(apr_readdir(thisdir) == APR_SUCCESS) {
>>         printf("%s %d\n", thisdir->entryname, apr_dir_entry_size(thisdir));
>>     }
>> }

I agree with Dean's answer on this one.



>The Comment:
>
>I don't like the thisdir->entryname thing.  I would much rather see a
>function/macro that returns the filename.  If it is a function, it could
>be implemented inline, but the way this is written, it implies a field
>that not all platforms need.  For example, in UNIX, I will most likely not
>put an entryname field in the apr_dir_t type.  I will put an struct
>dirent* in there, and when the user wants the directory name, I will
>return dirvar->dirent->d_name.

I've no problem with it being a function/macro, I just thought the entryname
idea presented the simplest interface. The ap_readdir() code can just do
  thisdir->entryname = thisdir->dirent->d_name;
before returning.

--
 ______________________________________________________________________________
 |  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