-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add memrchr, rawmemrchr, bump to 0.1.35
- Loading branch information
1 parent
999730a
commit eb614a8
Showing
14 changed files
with
832 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
AC_PREREQ(2.65) | ||
AC_INIT([libdicl], | ||
[0.1.34], | ||
[0.1.35], | ||
[[email protected]]) | ||
|
||
AC_SUBST(ACLOCAL_AMFLAGS, "-I macros") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ | |
# getopt-posix \ | ||
# getprogname \ | ||
# memmem \ | ||
# memrchr \ | ||
# mkdtemp \ | ||
# mktime \ | ||
# nanosleep \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* Stop reading the entries of a directory. | ||
Copyright (C) 2006-2019 Free Software Foundation, Inc. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
This program 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 General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
|
||
#include <config.h> | ||
|
||
/* Specification. */ | ||
#include <dirent.h> | ||
|
||
#if REPLACE_FCHDIR | ||
# include <unistd.h> | ||
#endif | ||
|
||
#if HAVE_CLOSEDIR | ||
|
||
/* Override closedir(), to keep track of the open file descriptors. | ||
Needed because there is a function dirfd(). */ | ||
|
||
#else | ||
|
||
# include <stdlib.h> | ||
|
||
# include "dirent-private.h" | ||
|
||
#endif | ||
|
||
int | ||
closedir (DIR *dirp) | ||
{ | ||
# if REPLACE_FCHDIR || REPLACE_DIRFD | ||
int fd = dirfd (dirp); | ||
# endif | ||
int retval; | ||
|
||
#if HAVE_CLOSEDIR | ||
# undef closedir | ||
|
||
retval = closedir (dirp); | ||
|
||
# ifdef __KLIBC__ | ||
if (!retval) | ||
_gl_unregister_dirp_fd (fd); | ||
# endif | ||
#else | ||
|
||
if (dirp->current != INVALID_HANDLE_VALUE) | ||
FindClose (dirp->current); | ||
free (dirp); | ||
|
||
retval = 0; | ||
|
||
#endif | ||
|
||
#if REPLACE_FCHDIR | ||
if (retval >= 0) | ||
_gl_unregister_fd (fd); | ||
#endif | ||
return retval; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* Private details of the DIR type. | ||
Copyright (C) 2011-2019 Free Software Foundation, Inc. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
This program 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 General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
|
||
#ifndef _DIRENT_PRIVATE_H | ||
#define _DIRENT_PRIVATE_H 1 | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
|
||
struct gl_directory | ||
{ | ||
/* Status, or error code to produce in next readdir() call. | ||
-2 means the end of the directory is already reached, | ||
-1 means the entry was already filled by FindFirstFile, | ||
0 means the entry needs to be filled using FindNextFile. | ||
A positive value is an error code. */ | ||
int status; | ||
/* Handle, reading the directory, at current position. */ | ||
HANDLE current; | ||
/* Found directory entry. */ | ||
WIN32_FIND_DATA entry; | ||
/* Argument to pass to FindFirstFile. It consists of the absolutized | ||
directory name, followed by a directory separator and the wildcards. */ | ||
char dir_name_mask[1]; | ||
}; | ||
|
||
#endif /* _DIRENT_PRIVATE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* Duplicate an open file descriptor. | ||
Copyright (C) 2011-2019 Free Software Foundation, Inc. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
This program 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 General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
|
||
#include <config.h> | ||
|
||
/* Specification. */ | ||
#include <unistd.h> | ||
|
||
#include <errno.h> | ||
|
||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER | ||
# include "msvc-inval.h" | ||
#endif | ||
|
||
#undef dup | ||
|
||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER | ||
static int | ||
dup_nothrow (int fd) | ||
{ | ||
int result; | ||
|
||
TRY_MSVC_INVAL | ||
{ | ||
result = dup (fd); | ||
} | ||
CATCH_MSVC_INVAL | ||
{ | ||
result = -1; | ||
errno = EBADF; | ||
} | ||
DONE_MSVC_INVAL; | ||
|
||
return result; | ||
} | ||
#elif defined __KLIBC__ | ||
# include <fcntl.h> | ||
# include <sys/stat.h> | ||
|
||
# include <InnoTekLIBC/backend.h> | ||
|
||
static int | ||
dup_nothrow (int fd) | ||
{ | ||
int dupfd; | ||
struct stat sbuf; | ||
|
||
dupfd = dup (fd); | ||
if (dupfd == -1 && errno == ENOTSUP \ | ||
&& !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) | ||
{ | ||
char path[_MAX_PATH]; | ||
|
||
/* Get a path from fd */ | ||
if (!__libc_Back_ioFHToPath (fd, path, sizeof (path))) | ||
dupfd = open (path, O_RDONLY); | ||
} | ||
|
||
return dupfd; | ||
} | ||
#else | ||
# define dup_nothrow dup | ||
#endif | ||
|
||
int | ||
rpl_dup (int fd) | ||
{ | ||
int result = dup_nothrow (fd); | ||
#if REPLACE_FCHDIR | ||
if (result >= 0) | ||
result = _gl_register_dup (fd, result); | ||
#endif | ||
return result; | ||
} |
Oops, something went wrong.