This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The dirent struct


On Aug  6 23:21, Chris Sutcliffe wrote:
> On 6 August 2010 20:31, Steven Monai wrote:
> > On 2010/08/06 11:48 AM, Chris Sutcliffe wrote:
> >> I've decided to take a different approach and decided to implement it
> >> as follows:
> >>
> >> #ifdef __CYGWIN__
> >> Â Â itr->d_fileno = entry->d_ino;
> >> Â Â itr->d_reclen = strlen(entry->d_name);
> >> #else
> >> Â Â itr->d_fileno = entry->d_fileno;
> >> Â Â itr->d_reclen = entry->d_reclen;
> >> #endif
> >>
> >> I assume this is appropriate?
> > [...]
> > "Defining d_*rec*len as strlen(d_name) would not be correct since that
> > is supposed to be the length of the record not the name."
> [...]
> I'll leave it as is for now (I figure having something there is better
> than nothing at all).

  itr->d_reclen = __builtin_offsetof (struct dirent, d_name)
                  + strlen (entry->d_name) + 1;


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]