Remove unused scandir() compat implementation
scandir() isn't used anywhere within the client, so we don't need to bother with a compat implementation for systems that don't have it.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2.2]
|
[Changes 1.2.2]
|
||||||
|
|
||||||
|
* Remove unused scandir() compat implementation. (caf)
|
||||||
|
|
||||||
* Use the same compat.o and ircsig.o object files for the wserv and scr-bx
|
* Use the same compat.o and ircsig.o object files for the wserv and scr-bx
|
||||||
binaries as for the main binary. (caf)
|
binaries as for the main binary. (caf)
|
||||||
|
|
||||||
|
|||||||
3
configure
vendored
3
configure
vendored
@@ -7161,8 +7161,7 @@ done
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for ac_func in socket gethostname gettimeofday strtoul strlcpy strlcat stpcpy vsnprintf snprintf setsid strerror uname getrusage sysconf getpgid killpg getlogin realpath fchdir getpass fpathconf getpwent setvbuf select mkstemp memmove setenv
|
||||||
for ac_func in socket gethostname gettimeofday strtoul strlcpy strlcat stpcpy vsnprintf snprintf setsid strerror uname getrusage sysconf getpgid killpg getlogin realpath fchdir getpass fpathconf getpwent setvbuf select mkstemp memmove scandir setenv
|
|
||||||
do
|
do
|
||||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ if test x"$cross_compiling" != x"yes"; then
|
|||||||
AC_FUNC_SETPGRP
|
AC_FUNC_SETPGRP
|
||||||
fi
|
fi
|
||||||
AC_FUNC_STRFTIME
|
AC_FUNC_STRFTIME
|
||||||
AC_CHECK_FUNCS(socket gethostname gettimeofday strtoul strlcpy strlcat stpcpy vsnprintf snprintf setsid strerror uname getrusage sysconf getpgid killpg getlogin realpath fchdir getpass fpathconf getpwent setvbuf select mkstemp memmove scandir setenv)
|
AC_CHECK_FUNCS(socket gethostname gettimeofday strtoul strlcpy strlcat stpcpy vsnprintf snprintf setsid strerror uname getrusage sysconf getpgid killpg getlogin realpath fchdir getpass fpathconf getpwent setvbuf select mkstemp memmove setenv)
|
||||||
dnl Need these for Solaris
|
dnl Need these for Solaris
|
||||||
AC_CHECK_FUNC(gethostbyname,,
|
AC_CHECK_FUNC(gethostbyname,,
|
||||||
AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS",))
|
AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS",))
|
||||||
|
|||||||
@@ -198,9 +198,6 @@
|
|||||||
/* Define to 1 if you have the <resolv.h> header file. */
|
/* Define to 1 if you have the <resolv.h> header file. */
|
||||||
#undef HAVE_RESOLV_H
|
#undef HAVE_RESOLV_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `scandir' function. */
|
|
||||||
#undef HAVE_SCANDIR
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `select' function. */
|
/* Define to 1 if you have the `select' function. */
|
||||||
#undef HAVE_SELECT
|
#undef HAVE_SELECT
|
||||||
|
|
||||||
|
|||||||
120
source/compat.c
120
source/compat.c
@@ -876,126 +876,6 @@ unsigned long strtoul (const char *nptr, char **endptr, int base)
|
|||||||
#endif /* DO NOT HAVE STRTOUL */
|
#endif /* DO NOT HAVE STRTOUL */
|
||||||
/* --- end of strtoul.c --- */
|
/* --- end of strtoul.c --- */
|
||||||
|
|
||||||
/* --- start of scandir.c --- */
|
|
||||||
#ifndef HAVE_SCANDIR
|
|
||||||
/*
|
|
||||||
* Scandir.c -- A painful file for painful operating systems
|
|
||||||
*
|
|
||||||
* Technically, scandir is not a "standard" function. It belongs to
|
|
||||||
* 4.2BSD derived systems, and most everone that has any repsect for their
|
|
||||||
* customers implements it sanely. Which probably explains why its broken
|
|
||||||
* on Solaris 2.
|
|
||||||
*
|
|
||||||
* I removed the 4BSD scandir function because it required intimite knowledge
|
|
||||||
* of what was inside the DIR type, which sort of defeats the point. What I
|
|
||||||
* left was this extremely generic scandir function that only depends on
|
|
||||||
* opendir(), readdir(), and closedir(), and perhaps the DIRSIZ macro.
|
|
||||||
* The only member of struct dirent we peer into is d_name.
|
|
||||||
*
|
|
||||||
* Public domain
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define RESIZEDIR(x, y, z) x = realloc((void *)(x), sizeof(y) * (z))
|
|
||||||
|
|
||||||
/* Initial guess at directory size. */
|
|
||||||
#define INITIAL_SIZE 30
|
|
||||||
|
|
||||||
typedef struct dirent DIRENT;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the system doesnt have a way to tell us how big a directory entry
|
|
||||||
* is, then we make a wild guess. This shouldnt ever be SMALLER than
|
|
||||||
* the actual size, and if its larger, so what? This will probably not
|
|
||||||
* be a size thats divisible by 4, so the memcpy() may not be super
|
|
||||||
* efficient. But so what? Any system that cant provide a decent scandir
|
|
||||||
* im not worried about efficiency.
|
|
||||||
*/
|
|
||||||
/* The SCO hack is at the advice of FireClown, thanks! =) */
|
|
||||||
#if defined(_SCO_DS)
|
|
||||||
# undef DIRSIZ
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DIRSIZ
|
|
||||||
# define DIRSIZ(d) (sizeof(DIRENT) + strlen(d->d_name) + 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Scan the directory dirname calling select to make a list of selected
|
|
||||||
* directory entries then sort using qsort and compare routine dcomp. Returns
|
|
||||||
* the number of entries and a pointer to a list of pointers to struct direct
|
|
||||||
* (through namelist). Returns -1 if there were any errors.
|
|
||||||
*/
|
|
||||||
int scandir (const char *name,
|
|
||||||
DIRENT ***list,
|
|
||||||
int (*selector) (DIRENT *),
|
|
||||||
int (*sorter) (const void *, const void *))
|
|
||||||
{
|
|
||||||
DIRENT **names;
|
|
||||||
static DIRENT *e;
|
|
||||||
DIR *dp;
|
|
||||||
int i;
|
|
||||||
int size = INITIAL_SIZE;
|
|
||||||
|
|
||||||
if (!(names = (DIRENT **)malloc(size * sizeof(DIRENT *))))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (access(name, R_OK | X_OK))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!(dp = opendir(name)))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Read entries in the directory. */
|
|
||||||
for (i = 0; (e = readdir(dp));)
|
|
||||||
{
|
|
||||||
if (!selector || (*selector)(e))
|
|
||||||
{
|
|
||||||
if (i + 1 >= size)
|
|
||||||
{
|
|
||||||
size <<= 1;
|
|
||||||
RESIZEDIR(names, DIRENT *, size);
|
|
||||||
if (!names)
|
|
||||||
{
|
|
||||||
closedir(dp);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
names[i] = (DIRENT *)malloc(DIRSIZ(e));
|
|
||||||
if (names[i] == NULL)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < i; j++)
|
|
||||||
free(names[j]);
|
|
||||||
free(names);
|
|
||||||
closedir(dp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
memcpy(names[i], e, DIRSIZ(e));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Truncate the "names" array down to its actual size (why?)
|
|
||||||
*/
|
|
||||||
RESIZEDIR(names, DIRENT *, i + 2);
|
|
||||||
names[i + 1] = 0;
|
|
||||||
*list = names;
|
|
||||||
closedir(dp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sort if neccesary...
|
|
||||||
*/
|
|
||||||
if (i && sorter)
|
|
||||||
qsort(names, i, sizeof(DIRENT *), sorter);
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* --- end of scandir.c --- */
|
|
||||||
|
|
||||||
/* --- start of env.c --- */
|
/* --- start of env.c --- */
|
||||||
#ifndef HAVE_SETENV
|
#ifndef HAVE_SETENV
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user