Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 5743 invoked by uid 6000); 13 May 1999 01:38:43 -0000 Received: (qmail 5477 invoked from network); 13 May 1999 01:38:36 -0000 Received: from silk.apana.org.au (root@202.12.87.81) by taz.hyperreal.org with SMTP; 13 May 1999 01:38:36 -0000 Received: from kheldar.apana.org.au (bjh@kheldar.apana.org.au [202.12.87.82]) by silk.apana.org.au (8.9.1/8.9.1) with SMTP id LAA20484 for ; Thu, 13 May 1999 11:38:19 +1000 Message-Id: <199905130138.LAA20484@silk.apana.org.au> From: "Brian Havard" To: "new-httpd@apache.org" Date: Thu, 13 May 1999 11:38:18 +1000 (EST) X-Mailer: PMMail 2.00.1500 for OS/2 Warp 4.00 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: APR: directory API Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org 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 | ------------------------------------------------------------------------------