diff --git a/configure.ac b/configure.ac index 0e5e13b56..f6558112e 100644 --- a/configure.ac +++ b/configure.ac @@ -302,6 +302,7 @@ AC_CHECK_FUNCS( futimes ) AC_CHECK_FUNCS( wcslcpy lrand48_r killpg ) AC_CHECK_FUNCS( backtrace_symbols getifaddrs ) AC_CHECK_FUNCS( futimens clock_gettime ) +AC_CHECK_FUNCS( getpwent ) AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] ) diff --git a/src/complete.cpp b/src/complete.cpp index 5ecf80eb9..9491c58b8 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -1187,6 +1187,13 @@ bool completer_t::try_complete_variable(const wcstring &str) { /// /// \return 0 if unable to complete, 1 otherwise bool completer_t::try_complete_user(const wcstring &str) { +#ifndef HAVE_GETPWENT + // The getpwent() function does not exist on Android. A Linux user on Android isn't + // really a user - each installed app gets an UID assigned. Listing all UID:s is not + // possible without root access, and doing a ~USER type expansion does not make sense + // since every app is sandboxed and can't access eachother. + return false; +#else const wchar_t *cmd = str.c_str(); const wchar_t *first_char = cmd; int res = 0; @@ -1233,6 +1240,7 @@ bool completer_t::try_complete_user(const wcstring &str) { } return res; +#endif } void complete(const wcstring &cmd_with_subcmds, std::vector *out_comps,