httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject Re: APR: directory API
Date Wed, 12 May 1999 15:54:36 GMT

I have no problem implementing this in UNIX.  I can do it later today or
tomorrow.  I have been meaning to re-visit this issue, but other things
keep getting in the way.  I have one question, and one comment.

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));
>     }
> }
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.

That is MHO, and I don't think I have done that for all the apr types, but
a lot of that is me being in a rush to get something so it will be ready
for when Apache needs it.  I have it in my plan to go back and clean
thigns up a bit.


Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message