patch: parentheses and remaining prototypes

J. Johnston
Mon Aug 28 13:22:00 GMT 2000

Werner Almesberger wrote:
> J. Johnston wrote:
> > I don't have a problem with using a define, except I would rather do it
> > the opposite way round.  POSIX doesn't specify the field
> Good point, I've changed it accordingly.
> >  This would require changing the few libc/sys/xxxx/sys/dirent.h files
> > that define d_namlen to define the macro as well (though many supply their
> > own scandir).
> It's actually rather weird: besides Linux, the only targets that set
> posix_dir=posix are *-*-cygwin* and powerpcle-*-pe. Incidently, they also
> set sys_dir=cygwin, and libc/sys/cygwin/sys/dirent.h has no d_namelen
> either. I don't quite understand how all this compiles for cygwin ...
> So I didn't change any headers for _DIRENT_HAVE_D_NAMLEN: cygwin seems be
> be better off without it anyway, and the others don't use libc/posix
> anyway.
> > My preference would be to leave [telldir] as returning "long" and
> > have Cygwin change the prototype unless there proves to be some good
> > reason to change it that I am unaware of.
> Okay, my patch adjusts the prototype. If there's a significant
> compatibility issue, we'd have to have a #define for this too, but
> that's up to the cygwin people to decide.

Thanks Werner.

The reason that scandir.c didn't experience problems is that Cygwin overrides
the file with its own implementation and the one in the posix directory is ifdef'd out.

The patch is checked in, however, I removed the change to libc/sys/cygwin/sys/dirent.h from this
patch.  The change in the header file should correspond to a change in the cygwin source code.  I
have made Chris aware of this issue and will leave it to him to make the changes.

-- Jeff Johnston (Red Hat Inc)

> ---------------------------------- ChangeLog ----------------------------------
> 2000-08-27  Werner Almesberger  <>
>         * libc/posix/scandir.c (DIRSIZ, scandir): use struct dirent.d_namlen
>         only if _DIRENT_HAVE_D_NAMLEN is defined
>         * libc/posix/scandir.c (alphasort): aligned prototype with
>         libc/sys/cygwin/sys/dirent.h and simplified function body
>         * libc/posix/telldir.c (telldir) libc/sys/cygwin/sys/dirent.h
>         (telldir): changed "telldir" prototype to  long telldir (DIR *)
>         as mentioned in annex B of POSIX.1
> ------------------------------------ patch ------------------------------------

More information about the Newlib mailing list