1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Autoconf workaround for missing <glob.h>.

glob.h is another missing facility in Android+Termux.

The workaround is to condition out local wildcard support completely,
so that PSFTP commands like 'mput *.txt' won't manage to do anything.
But at least the program will compile.
This commit is contained in:
Simon Tatham 2019-03-26 19:09:35 +00:00
parent 9375d1325f
commit c2df294e9e
2 changed files with 26 additions and 2 deletions

View File

@ -175,7 +175,7 @@ AC_CHECK_LIB(X11, XOpenDisplay,
AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx fstatat dirfd futimes setpwent endpwent])
AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
AC_CHECK_HEADERS([sys/auxv.h asm/hwcap.h])
AC_CHECK_HEADERS([sys/auxv.h asm/hwcap.h glob.h])
AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Define if clock_gettime() is available])])
AC_CACHE_CHECK([for SO_PEERCRED and dependencies], [x_cv_linux_so_peercred], [

View File

@ -12,12 +12,15 @@
#include <utime.h>
#include <errno.h>
#include <assert.h>
#include <glob.h>
#include "putty.h"
#include "ssh.h"
#include "psftp.h"
#if HAVE_GLOB_H
#include <glob.h>
#endif
/*
* In PSFTP our selects are synchronous, so these functions are
* empty stubs.
@ -358,6 +361,7 @@ int test_wildcard(const char *name, bool cmdline)
*/
return WCTYPE_NONEXISTENT;
} else {
#if HAVE_GLOB_H
glob_t globbed;
int ret = WCTYPE_NONEXISTENT;
@ -368,12 +372,18 @@ int test_wildcard(const char *name, bool cmdline)
}
return ret;
#else
/* On a system without glob.h, we just have to return a
* failure code */
return WCTYPE_NONEXISTENT;
#endif
}
}
/*
* Actually return matching file names for a local wildcard.
*/
#if HAVE_GLOB_H
struct WildcardMatcher {
glob_t globbed;
int i;
@ -400,6 +410,20 @@ void finish_wildcard_matching(WildcardMatcher *dir) {
globfree(&dir->globbed);
sfree(dir);
}
#else
WildcardMatcher *begin_wildcard_matching(const char *name)
{
return NULL;
}
char *wildcard_get_filename(WildcardMatcher *dir)
{
unreachable("Can't construct a valid WildcardMatcher without <glob.h>");
}
void finish_wildcard_matching(WildcardMatcher *dir)
{
unreachable("Can't construct a valid WildcardMatcher without <glob.h>");
}
#endif
char *stripslashes(const char *str, bool local)
{