- Also set reclen to 31 in readdir.
- Tested on z80pack.
- Only compile-tested on 6809.
SRC_C += malloc.c mkfifo.c mkstemps.c nanosleep.c opendir.c pause.c perror.c
SRC_C += popen.c printf.c putenv.c putgetch.c putpwent.c putw.c pwent.c qsort.c
SRC_C += raise.c rand.c readdir.c readlink.c realloc.c regerror.c
-SRC_C += regsub.c remove.c rewind.c rindex.c setbuffer.c setenv.c
+SRC_C += regsub.c remove.c rewind.c rewinddir.c rindex.c seekdir.c setbuffer.c setenv.c
SRC_C += setlocale.c setvbuf.c settimeofday.c sleep.c sprintf.c
SRC_C += stat.c stdio0.c stime.c
SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c
SRC_C += strnlen.c strnicmp.c strsep.c strxfrm.c strcoll.c strsignal.c
-SRC_C += strtod.c strtol.c swab.c system.c time.c tmpfile.c tmpnam.c ttyname.c
+SRC_C += strtod.c strtol.c swab.c system.c telldir.c time.c tmpfile.c tmpnam.c ttyname.c
SRC_C += tzset.c ungetc.c usleep.c utent.c utimes.c utsname.c
SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c
SRC_C += gethostname.c sysconf.c confstr.c memccpy.c getpass.c
SRC_C += malloc.c mkfifo.c mkstemps.c nanosleep.c opendir.c pause.c perror.c
SRC_C += popen.c printf.c putenv.c putchar.c putpwent.c putw.c pwent.c qsort.c
SRC_C += raise.c rand.c readdir.c readlink.c realloc.c regerror.c
-SRC_C += regsub.c remove.c rewind.c rindex.c setbuffer.c setenv.c
+SRC_C += regsub.c remove.c rewind.c rewinddir.c rindex.c seekdir.c setbuffer.c setenv.c
SRC_C += setlocale.c setvbuf.c settimeofday.c sleep.c sprintf.c
SRC_C += stat.c stdio0.c stime.c
SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c
SRC_C += strnlen.c strnicmp.c strsep.c strsignal.c strxfrm.c strcoll.c
-SRC_C += strtod.c strtol.c swab.c system.c time.c tmpfile.c tmpnam.c ttyname.c
+SRC_C += strtod.c strtol.c swab.c system.c telldir.c time.c tmpfile.c tmpnam.c ttyname.c
SRC_C += tzset.c ungetc.c usleep.c utent.c utimes.c utsname.c
SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c
SRC_C += gethostname.c sysconf.c confstr.c memccpy.c getpass.c
free(dir);
return NULL;
}
+
+ dir->d.dd_loc = 0;
return (DIR *)dir;
}
struct _dir *dir = (struct _dir *)dirp;
struct __dirent *direntry;
register struct dirent *buf;
- int len;
if (dir == NULL || dir->d.dd_fd == -1) {
errno = EFAULT;
buf = &dir->de;
buf->d_ino = direntry->d_ino;
buf->d_off = -1; /* FIXME */
- buf->d_reclen = 33;
+ buf->d_reclen = 31;
+ dir->d.dd_loc += (buf->d_reclen + 1);
strncpy(buf->d_name, (char *) direntry->d_name, 31);
buf->d_name[30] = 0;
return buf;
--- /dev/null
+#include <dirent.h>
+#include <unistd.h>
+
+void rewinddir(DIR *dirp)
+{
+ struct _dir *dir = (struct _dir *)dirp;
+ lseek(dir->d.dd_fd, dir->d.dd_loc = 0, SEEK_SET);
+ dir->next = dir->last = 0;
+}
--- /dev/null
+#include <dirent.h>
+#include <unistd.h>
+
+void seekdir (DIR * dirp, off_t pos)
+{
+ struct _dir *dir = (struct _dir *)dirp;
+ lseek(dir->d.dd_fd, dir->d.dd_loc = pos, SEEK_SET);
+ dir->next = dir->last = 0;
+}
--- /dev/null
+#include <dirent.h>
+
+off_t telldir(DIR * dirp)
+{
+ struct _dir *dir = (struct _dir *)dirp;
+ return dir->d.dd_loc;
+}