aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2000-08-28 20:06:54 +0000
committerJeff Johnston <jjohnstn@redhat.com>2000-08-28 20:06:54 +0000
commit6beeb24016323fbe67a8c2ca32e07b279df4dfd3 (patch)
tree9399e1e58e02c5e4e53fadefd9a78b1dfc22d2a4 /newlib
parentef44da427fe0883e1b4fd60cacbcc94b574f5911 (diff)
downloadnewlib-6beeb24016323fbe67a8c2ca32e07b279df4dfd3.zip
newlib-6beeb24016323fbe67a8c2ca32e07b279df4dfd3.tar.gz
newlib-6beeb24016323fbe67a8c2ca32e07b279df4dfd3.tar.bz2
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
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog9
-rw-r--r--newlib/libc/posix/scandir.c16
-rw-r--r--newlib/libc/posix/telldir.c2
3 files changed, 22 insertions, 5 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 68283e3..9661de9 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,5 +1,14 @@
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>
+
* libc/machine/i386/i386mach.h: added SOTYPE_FUNCTION to set type
of global entry points if _I386MACH_NEED_SOTYPE_FUNCTION is defined;
Added __CLI and __STI macros (controlled via
diff --git a/newlib/libc/posix/scandir.c b/newlib/libc/posix/scandir.c
index 895879b..6acaff7 100644
--- a/newlib/libc/posix/scandir.c
+++ b/newlib/libc/posix/scandir.c
@@ -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.
*/
#undef DIRSIZ
+#ifdef _DIRENT_HAVE_D_NAMLEN
#define DIRSIZ(dp) \
((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
#define __P(args) ()
@@ -103,8 +108,12 @@ scandir(dirname, namelist, select, dcomp)
return(-1);
p->d_ino = d->d_ino;
p->d_reclen = d->d_reclen;
+#ifdef _DIRENT_HAVE_D_NAMLEN
p->d_namlen = d->d_namlen;
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
* realloc the maximum size.
@@ -132,11 +141,10 @@ scandir(dirname, namelist, select, dcomp)
*/
int
alphasort(d1, d2)
- const void *d1;
- const void *d2;
+ const struct dirent **d1;
+ const struct dirent **d2;
{
- return(strcmp((*(struct dirent **)d1)->d_name,
- (*(struct dirent **)d2)->d_name));
+ return(strcmp((*d1)->d_name, (*d2)->d_name));
}
#endif /* ! HAVE_OPENDIR */
diff --git a/newlib/libc/posix/telldir.c b/newlib/libc/posix/telldir.c
index 90b12f9..30c0037 100644
--- a/newlib/libc/posix/telldir.c
+++ b/newlib/libc/posix/telldir.c
@@ -73,7 +73,7 @@ static struct ddloc *dd_hash[NDIRHASH]; /* Hash list heads for ddlocs */
*/
long
telldir(dirp)
- const DIR *dirp;
+ DIR *dirp;
{
register int index;
register struct ddloc *lp;