From 8008bae486f0bb79bcadaabb79bb11f85256fbef Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 9 May 2005 19:42:03 +0000 Subject: * readline/aclocal.m4: Use AC_TRY_LINK to check for mbstate_t. * readline/complete.c (pwd.h): Guard with HAVE_PWD_H. (getpwent): Guard with HAVE_GETPWENT. (rl_username_completion_function): Guard use of getpwent. (endpwent): Likewise. * readline/config.h.in (HAVE_FCNTL): New macro. (HAVE_GETPWENT): Likewise. (HAVE_GETPWNAM): Likewise. (HAVE_GETPWUID): Likewise. (HAVE_KILL): Likewise. (HAVE_PWD_H): Likewise. * readline/configure: Regenerated. * readline/configure.in: Handle MinGW when cross compiling. Check for getpwnam, getpwent, getpwuid, kill, and pwd.h. * readline/display.c (rl_clear_screen): Treat Windows like DOS. (insert_some_chars): Likewise. (delete_chars): Likewise. * readline/shell.c (pwd.h): Guard with HAVE_PWD_H. (getpwuid): Guard with HAVE_GETPWUID. (sh_unset_nodelay_mode): Guard use of fnctl with HAVE_FNCTL_H. * readline/signals.c (rl_signal_handler): Don't use SIGALRM or SIGQUIT if not defined. Use "raise" if "kill" is not available. (rl_set_signals): Don't set handlers for SIGQUIT or SIGALRM if they are not defined. (rl_clear_signals): Likewise. * readline/tilde.c (pwd.h): Guard with HAVE_PWD_H. (getpwuid): Guard declaration with HAVE_GETPWUID. (getpwnam): Guard declaration with HAVE_GETPWNAM. (tilde_expand_word): Guard use of getpwnam with HAVE_GETPWNAM. --- readline/complete.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'readline/complete.c') diff --git a/readline/complete.c b/readline/complete.c index 21a9d70859b..a4ff24e8720 100644 --- a/readline/complete.c +++ b/readline/complete.c @@ -48,7 +48,9 @@ extern int errno; #endif /* !errno */ +#ifdef HAVE_PWD_H #include +#endif #include "posixdir.h" #include "posixstat.h" @@ -79,9 +81,10 @@ typedef int QSFUNC (); /* Most systems don't declare getpwent in if _POSIX_SOURCE is defined. */ -#if !defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE) +#if defined(HAVE_GETPWENT) && \ + (!defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE)) extern struct passwd *getpwent PARAMS((void)); -#endif /* !HAVE_GETPW_DECLS || _POSIX_SOURCE */ +#endif /* defiend (HAVE_GETPWENT) && (!HAVE_GETPW_DECLS || _POSIX_SOURCE) */ /* If non-zero, then this is the address of a function to call when completing a word would normally display the list of possible matches. @@ -1662,16 +1665,20 @@ rl_username_completion_function (text, state) setpwent (); } +#ifdef HAVE_GETPWENT while (entry = getpwent ()) { /* Null usernames should result in all users as possible completions. */ if (namelen == 0 || (STREQN (username, entry->pw_name, namelen))) break; } +#endif if (entry == 0) { +#ifdef HAVE_GETPWENT endpwent (); +#endif return ((char *)NULL); } else -- cgit v1.2.1