2000-08-27 Werner Almesberger <Werner.Almesberger@epfl.ch>
* libc/posix/scandir.c (DIRSIZ, scandir): use struct dirent.d_namlen only if _DIRENT_HAVE_D_NAMLEN is defined. (alphasort): aligned prototype with libc/sys/cygwin/sys/dirent.h and simplified function body. * libc/posix/telldir.c (telldir): changed "telldir" prototype to long telldir (DIR *) as mentioned in annex B of POSIX.1
This commit is contained in:
parent
ef44da427f
commit
6beeb24016
|
@ -1,3 +1,12 @@
|
||||||
|
2000-08-27 Werner Almesberger <Werner.Almesberger@epfl.ch>
|
||||||
|
|
||||||
|
* libc/posix/scandir.c (DIRSIZ, scandir): use struct dirent.d_namlen
|
||||||
|
only if _DIRENT_HAVE_D_NAMLEN is defined.
|
||||||
|
(alphasort): aligned prototype with
|
||||||
|
libc/sys/cygwin/sys/dirent.h and simplified function body.
|
||||||
|
* libc/posix/telldir.c (telldir): changed "telldir" prototype to
|
||||||
|
long telldir (DIR *) as mentioned in annex B of POSIX.1
|
||||||
|
|
||||||
2000-08-27 Werner Almesberger <Werner.Almesberger@epfl.ch>
|
2000-08-27 Werner Almesberger <Werner.Almesberger@epfl.ch>
|
||||||
|
|
||||||
* libc/machine/i386/i386mach.h: added SOTYPE_FUNCTION to set type
|
* libc/machine/i386/i386mach.h: added SOTYPE_FUNCTION to set type
|
||||||
|
|
|
@ -57,8 +57,13 @@ static char sccsid[] = "@(#)scandir.c 5.10 (Berkeley) 2/23/91";
|
||||||
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
|
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
|
||||||
*/
|
*/
|
||||||
#undef DIRSIZ
|
#undef DIRSIZ
|
||||||
|
#ifdef _DIRENT_HAVE_D_NAMLEN
|
||||||
#define DIRSIZ(dp) \
|
#define DIRSIZ(dp) \
|
||||||
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
|
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
|
||||||
|
#else
|
||||||
|
#define DIRSIZ(dp) \
|
||||||
|
((sizeof (struct dirent) - (MAXNAMLEN+1)) + ((strlen((dp)->d_name)+1 + 3) &~ 3))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __P
|
#ifndef __P
|
||||||
#define __P(args) ()
|
#define __P(args) ()
|
||||||
|
@ -103,8 +108,12 @@ scandir(dirname, namelist, select, dcomp)
|
||||||
return(-1);
|
return(-1);
|
||||||
p->d_ino = d->d_ino;
|
p->d_ino = d->d_ino;
|
||||||
p->d_reclen = d->d_reclen;
|
p->d_reclen = d->d_reclen;
|
||||||
|
#ifdef _DIRENT_HAVE_D_NAMLEN
|
||||||
p->d_namlen = d->d_namlen;
|
p->d_namlen = d->d_namlen;
|
||||||
bcopy(d->d_name, p->d_name, p->d_namlen + 1);
|
bcopy(d->d_name, p->d_name, p->d_namlen + 1);
|
||||||
|
#else
|
||||||
|
strcpy(p->d_name, d->d_name);
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Check to make sure the array has space left and
|
* Check to make sure the array has space left and
|
||||||
* realloc the maximum size.
|
* realloc the maximum size.
|
||||||
|
@ -132,11 +141,10 @@ scandir(dirname, namelist, select, dcomp)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
alphasort(d1, d2)
|
alphasort(d1, d2)
|
||||||
const void *d1;
|
const struct dirent **d1;
|
||||||
const void *d2;
|
const struct dirent **d2;
|
||||||
{
|
{
|
||||||
return(strcmp((*(struct dirent **)d1)->d_name,
|
return(strcmp((*d1)->d_name, (*d2)->d_name));
|
||||||
(*(struct dirent **)d2)->d_name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ! HAVE_OPENDIR */
|
#endif /* ! HAVE_OPENDIR */
|
||||||
|
|
|
@ -73,7 +73,7 @@ static struct ddloc *dd_hash[NDIRHASH]; /* Hash list heads for ddlocs */
|
||||||
*/
|
*/
|
||||||
long
|
long
|
||||||
telldir(dirp)
|
telldir(dirp)
|
||||||
const DIR *dirp;
|
DIR *dirp;
|
||||||
{
|
{
|
||||||
register int index;
|
register int index;
|
||||||
register struct ddloc *lp;
|
register struct ddloc *lp;
|
||||||
|
|
Loading…
Reference in New Issue