diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-12-20 02:29:00 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-12-20 02:29:00 +0000 |
commit | d693ad844979b8f5596dde99a0cbec070af73683 (patch) | |
tree | 1b60e394a1807abc3c92bf9b0cbb88b3fdb157c4 /newlib/libc/sys/go32/dir.c | |
parent | 3ace1da676318a591ee314b784f37661e52cfb75 (diff) | |
download | cygnal-d693ad844979b8f5596dde99a0cbec070af73683.tar.gz cygnal-d693ad844979b8f5596dde99a0cbec070af73683.tar.bz2 cygnal-d693ad844979b8f5596dde99a0cbec070af73683.zip |
2002-12-19 Jeff Johnston <jjohnstn@redhat.com>
* configure.host: Remove references to go32.
* libc/sys/go32/*: Removed.
Diffstat (limited to 'newlib/libc/sys/go32/dir.c')
-rw-r--r-- | newlib/libc/sys/go32/dir.c | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/newlib/libc/sys/go32/dir.c b/newlib/libc/sys/go32/dir.c deleted file mode 100644 index ba3831a82..000000000 --- a/newlib/libc/sys/go32/dir.c +++ /dev/null @@ -1,95 +0,0 @@ -#include <string.h> - -#include "sys/dir.h" -#include "sys/dirent.h" -#include <errno.h> - -DIR *opendir(char *name) -{ - int length; - DIR *dir = (DIR *)malloc(sizeof(DIR)); - dir->num_read = 0; - dir->name = (char *)malloc(strlen(name)+6); - strcpy(dir->name, name); - - /* Append a "." if we got only the device name */ - if (dir->name[1] == ':' && strlen(dir->name) == 2) - strcat(dir->name, "."); - - /* Strip trailing slashes, so we can append "/*.*" */ - while (1) - { - length = strlen(dir->name); - if (length == 0) break; - if (dir->name[length - 1] == '/' || - dir->name[length - 1] == '\\') - dir->name[length - 1] = '\0'; - else - break; - } - - strcat(dir->name, "/*.*"); - return dir; -} - - - -static char *strlwr(char *s) -{ - char *p = s; - while (*s) - { - if ((*s >= 'A') && (*s <= 'Z')) - *s += 'a'-'A'; - s++; - } - return p; -} - -struct dirent *readdir(DIR *dir) -{ - int done; - int oerrno = errno; - if (dir->num_read) - done = findnext(&dir->ff); - else - done = findfirst(dir->name, &dir->ff, - FA_ARCH|FA_RDONLY|FA_DIREC|FA_HIDDEN|FA_SYSTEM); - if (done) - { - if (errno == ENMFILE) - errno = oerrno; - return 0; - } - dir->num_read ++; - dir->de.d_namlen = strlen(dir->ff.ff_name); - strcpy(dir->de.d_name,dir->ff.ff_name); - strlwr(dir->de.d_name); - return &dir->de; -} - -long telldir(DIR *dir) -{ - return dir->num_read; -} - -void seekdir(DIR *dir, long loc) -{ - int i; - rewinddir(dir); - for (i=0; i<loc; i++) - readdir(dir); -} - -void rewinddir(DIR *dir) -{ - dir->num_read = 0; -} - -int closedir(DIR *dir) -{ - free(dir->name); - free(dir); - return 0; -} - |