Split libc/dirent/dir.cpp into multiple files.
This commit is contained in:
parent
d7467e98be
commit
ddce6045e0
|
@ -22,7 +22,17 @@ aux/c++.o \
|
||||||
aux/op-new.o \
|
aux/op-new.o \
|
||||||
ctype/ctype.o \
|
ctype/ctype.o \
|
||||||
dirent/alphasort.o \
|
dirent/alphasort.o \
|
||||||
dirent/dir.o \
|
dirent/closedir.o \
|
||||||
|
dirent/dclearerr.o \
|
||||||
|
dirent/dcloseall.o \
|
||||||
|
dirent/deof.o \
|
||||||
|
dirent/derror.o \
|
||||||
|
dirent/dirfd.o \
|
||||||
|
dirent/dnewdir.o \
|
||||||
|
dirent/dregister.o \
|
||||||
|
dirent/dunregister.o \
|
||||||
|
dirent/readdir.o \
|
||||||
|
dirent/rewinddir.o \
|
||||||
dirent/versionsort.o \
|
dirent/versionsort.o \
|
||||||
errno/errno.o \
|
errno/errno.o \
|
||||||
fnmatch/fnmatch.o \
|
fnmatch/fnmatch.o \
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/closedir.cpp
|
||||||
|
Closes a directory stream.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
extern "C" int closedir(DIR* dir)
|
||||||
|
{
|
||||||
|
int result = dir->close_func ? dir->close_func(dir->user) : 0;
|
||||||
|
dunregister(dir);
|
||||||
|
free(dir->entry);
|
||||||
|
if ( dir->free_func )
|
||||||
|
dir->free_func(dir);
|
||||||
|
return result;
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/dclearerr.cpp
|
||||||
|
Clears the error flag from a directory stream.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
|
||||||
|
extern "C" void dclearerr(DIR* dir)
|
||||||
|
{
|
||||||
|
dir->flags &= ~_DIR_ERROR;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/dcloseall.cpp
|
||||||
|
Closes all registered directory streams.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
extern "C" { DIR* __firstdir = NULL; }
|
||||||
|
|
||||||
|
extern "C" int dcloseall(void)
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
while ( __firstdir )
|
||||||
|
result |= closedir(__firstdir);
|
||||||
|
return result ? EOF : 0;
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/deof.cpp
|
||||||
|
Returns the end-of-file flag of a directory stream.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
|
||||||
|
extern "C" int deof(DIR* dir)
|
||||||
|
{
|
||||||
|
return dir->flags & _DIR_EOF;
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/derror.cpp
|
||||||
|
Returns the error flag of a directory stream.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
|
||||||
|
extern "C" int derror(DIR* dir)
|
||||||
|
{
|
||||||
|
return dir->flags & _DIR_ERROR;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/dirfd.cpp
|
||||||
|
Returns the file descriptor associated with the directory stream.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
extern "C" int dirfd(DIR* dir)
|
||||||
|
{
|
||||||
|
if ( !dir->fd_func )
|
||||||
|
return errno = EBADF, 0;
|
||||||
|
return dir->fd_func(dir->user);
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/dnewdir.cpp
|
||||||
|
Allocates and registers a new directory stream structure.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
static void dfreedir(DIR* dir)
|
||||||
|
{
|
||||||
|
free(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" DIR* dnewdir(void)
|
||||||
|
{
|
||||||
|
DIR* dir = (DIR*) calloc(sizeof(DIR), 1);
|
||||||
|
if ( !dir )
|
||||||
|
return NULL;
|
||||||
|
dir->flags = 0;
|
||||||
|
dir->free_func = dfreedir;
|
||||||
|
dregister(dir);
|
||||||
|
return dir;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/dregister.cpp
|
||||||
|
Registers an directory stream for later automatic closing.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
|
||||||
|
extern "C" void dregister(DIR* dir)
|
||||||
|
{
|
||||||
|
dir->flags |= _DIR_REGISTERED;
|
||||||
|
if ( (dir->next = __firstdir) )
|
||||||
|
dir->next->prev = dir;
|
||||||
|
__firstdir = dir;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/dunregister.cpp
|
||||||
|
Unregisters an directory stream for later automatic closing.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
|
||||||
|
extern "C" void dunregister(DIR* dir)
|
||||||
|
{
|
||||||
|
if ( !(dir->flags & _DIR_REGISTERED) )
|
||||||
|
return;
|
||||||
|
if ( !dir->prev )
|
||||||
|
__firstdir = dir->next;
|
||||||
|
if ( dir->prev )
|
||||||
|
dir->prev->next = dir->next;
|
||||||
|
if ( dir->next )
|
||||||
|
dir->next->prev = dir->prev;
|
||||||
|
dir->flags &= ~_DIR_REGISTERED;
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2011.
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
This file is part of the Sortix C Library.
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
@ -17,50 +17,24 @@
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
dirent/dir.cpp
|
dirent/readdir.cpp
|
||||||
DIR* is an interface allowing various directory backends.
|
Reads a directory entry from a directory stream into a DIR-specific buffer.
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <DIR.h>
|
#include <DIR.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static DIR* firstdir = NULL;
|
|
||||||
|
|
||||||
extern "C" void dregister(DIR* dir)
|
|
||||||
{
|
|
||||||
dir->flags |= _DIR_REGISTERED;
|
|
||||||
if ( !firstdir ) { firstdir = dir; return; }
|
|
||||||
dir->next = firstdir;
|
|
||||||
firstdir->prev = dir;
|
|
||||||
firstdir = dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void dunregister(DIR* dir)
|
|
||||||
{
|
|
||||||
if ( !(dir->flags & _DIR_REGISTERED) )
|
|
||||||
return;
|
|
||||||
if ( !dir->prev )
|
|
||||||
firstdir = dir->next;
|
|
||||||
if ( dir->prev )
|
|
||||||
dir->prev->next = dir->next;
|
|
||||||
if ( dir->next )
|
|
||||||
dir->next->prev = dir->prev;
|
|
||||||
dir->flags &= ~_DIR_REGISTERED;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" struct dirent* readdir(DIR* dir)
|
extern "C" struct dirent* readdir(DIR* dir)
|
||||||
{
|
{
|
||||||
if ( !dir->read_func )
|
if ( !dir->read_func )
|
||||||
{
|
{
|
||||||
dir->flags |= _DIR_ERROR;
|
dir->flags |= _DIR_ERROR;
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = dir->entrysize;
|
size_t size = dir->entrysize;
|
||||||
|
@ -70,6 +44,7 @@ extern "C" struct dirent* readdir(DIR* dir)
|
||||||
dir->flags |= _DIR_ERROR;
|
dir->flags |= _DIR_ERROR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 0 < status )
|
if ( 0 < status )
|
||||||
{
|
{
|
||||||
struct dirent* biggerdir = (struct dirent*) malloc(size);
|
struct dirent* biggerdir = (struct dirent*) malloc(size);
|
||||||
|
@ -94,66 +69,3 @@ extern "C" struct dirent* readdir(DIR* dir)
|
||||||
|
|
||||||
return dir->entry;
|
return dir->entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int closedir(DIR* dir)
|
|
||||||
{
|
|
||||||
int result = (dir->close_func) ? dir->close_func(dir->user) : 0;
|
|
||||||
dunregister(dir);
|
|
||||||
free(dir->entry);
|
|
||||||
if ( dir->free_func )
|
|
||||||
dir->free_func(dir);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void rewinddir(DIR* dir)
|
|
||||||
{
|
|
||||||
if ( dir->rewind_func )
|
|
||||||
dir->rewind_func(dir->user);
|
|
||||||
dir->flags &= ~_DIR_EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int dirfd(DIR* dir)
|
|
||||||
{
|
|
||||||
if ( !dir->fd_func )
|
|
||||||
return errno = EBADF, 0;
|
|
||||||
return dir->fd_func(dir->user);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void dclearerr(DIR* dir)
|
|
||||||
{
|
|
||||||
dir->flags &= ~_DIR_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int derror(DIR* dir)
|
|
||||||
{
|
|
||||||
return dir->flags & _DIR_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int deof(DIR* dir)
|
|
||||||
{
|
|
||||||
return dir->flags & _DIR_EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dfreedir(DIR* dir)
|
|
||||||
{
|
|
||||||
free(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" DIR* dnewdir(void)
|
|
||||||
{
|
|
||||||
DIR* dir = (DIR*) calloc(sizeof(DIR), 1);
|
|
||||||
if ( !dir )
|
|
||||||
return NULL;
|
|
||||||
dir->flags = 0;
|
|
||||||
dir->free_func = dfreedir;
|
|
||||||
dregister(dir);
|
|
||||||
return dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int dcloseall(void)
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
while ( firstdir )
|
|
||||||
result |= closedir(firstdir);
|
|
||||||
return result ? EOF : 0;
|
|
||||||
}
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dirent/rewinddir.cpp
|
||||||
|
Rewinds a directory stream to the start.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <DIR.h>
|
||||||
|
|
||||||
|
extern "C" void rewinddir(DIR* dir)
|
||||||
|
{
|
||||||
|
if ( dir->rewind_func )
|
||||||
|
dir->rewind_func(dir->user);
|
||||||
|
dir->flags &= ~_DIR_EOF;
|
||||||
|
}
|
|
@ -86,6 +86,10 @@ int derror(DIR* dir);
|
||||||
int deof(DIR* dif);
|
int deof(DIR* dif);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__is_sortix_libc)
|
||||||
|
extern DIR* __firstdir;
|
||||||
|
#endif
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue