diff --git a/Changelog b/Changelog index c1bbe14..33a6938 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [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 binaries as for the main binary. (caf) diff --git a/configure b/configure index 200c6eb..d901fc2 100755 --- a/configure +++ b/configure @@ -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 scandir 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 setenv do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.in b/configure.in index 3b4df86..73e977f 100644 --- a/configure.in +++ b/configure.in @@ -198,7 +198,7 @@ if test x"$cross_compiling" != x"yes"; then AC_FUNC_SETPGRP fi 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 AC_CHECK_FUNC(gethostbyname,, AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS",)) diff --git a/include/defs.h.in b/include/defs.h.in index 732b189..01e9752 100644 --- a/include/defs.h.in +++ b/include/defs.h.in @@ -198,9 +198,6 @@ /* Define to 1 if you have the header file. */ #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. */ #undef HAVE_SELECT diff --git a/source/compat.c b/source/compat.c index 6e83db7..4609980 100644 --- a/source/compat.c +++ b/source/compat.c @@ -876,126 +876,6 @@ unsigned long strtoul (const char *nptr, char **endptr, int base) #endif /* DO NOT HAVE STRTOUL */ /* --- 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 --- */ #ifndef HAVE_SETENV /*