* 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.
This commit is contained in:
Mark Mitchell 2005-05-09 19:42:03 +00:00
parent 8b04f8b6ef
commit 430b783269
10 changed files with 1209 additions and 528 deletions

View file

@ -1,3 +1,35 @@
2005-05-09 Mark Mitchell <mark@codesourcery.com>
* 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.
2004-02-19 Andrew Cagney <cagney@redhat.com>
* config.guess: Update from version 2003-06-12 to 2004-02-16.

6
readline/aclocal.m4 vendored
View file

@ -1663,9 +1663,9 @@ fi
AC_SUBST(WCWIDTH_OBJ)
AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
[AC_TRY_RUN([
#include <wchar.h>
int
[AC_TRY_LINK(
[#include <wchar.h>],
[int
main ()
{
mbstate_t ps;

View file

@ -48,7 +48,9 @@
extern int errno;
#endif /* !errno */
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#include "posixdir.h"
#include "posixstat.h"
@ -79,9 +81,10 @@ typedef int QSFUNC ();
/* Most systems don't declare getpwent in <pwd.h> 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

View file

@ -22,12 +22,18 @@
#undef VOID_SIGHANDLER
/* Define if you have the fcntl function. */
#undef HAVE_FCNTL
/* Define if you have the isascii function. */
#undef HAVE_ISASCII
/* Define if you have the isxdigit function. */
#undef HAVE_ISXDIGIT
/* Define if you have the kill function. */
#undef HAVE_KILL
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
@ -43,6 +49,15 @@
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the getpwent function. */
#undef HAVE_GETPWENT
/* Define if you have the getpwnam function. */
#undef HAVE_GETPWNAM
/* Define if you have the getpwnam function. */
#undef HAVE_GETPWUID
/* Define if you have the select function. */
#undef HAVE_SELECT
@ -90,6 +105,9 @@
/* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H

1599
readline/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -56,16 +56,22 @@ if test "x$cross_compiling" = "xyes"; then
case "${host}" in
*-cygwin*)
cross_cache=${srcdir}/cross-build/cygwin.cache
LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap"
;;
*-mingw32*)
cross_cache=${srcdir}/cross-build/mingw.cache
;;
*) echo "configure: cross-compiling for a non-cygwin target is not supported" >&2
;;
esac
if test "x$cross_cache" != "x"; then
if test -r "${cross_cache}"; then
echo "loading cross-build cache file ${cross_cache}"
. ${cross_cache}
fi
LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap"
unset cross_cache
;;
*) echo "configure: cross-compiling for a non-cygwin target is not supported" >&2
;;
esac
fi
fi
if test "x$cross_compiling" = "xyes"; then
@ -112,14 +118,16 @@ AC_CHECK_TYPE(ssize_t, int)
AC_HEADER_STAT
AC_HEADER_DIRENT
AC_CHECK_FUNCS(lstat memmove putenv select setenv setlocale \
strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit)
AC_CHECK_FUNCS(fcntl kill lstat memmove putenv select setenv setlocale \
strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit \
getpwname getpwent getpwuid)
AC_FUNC_STRCOLL
AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
limits.h sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
termcap.h termios.h termio.h sys/file.h locale.h memory.h )
termcap.h termios.h termio.h sys/file.h locale.h memory.h \
pwd.h)
BASH_SYS_SIGNAL_VINTAGE
BASH_SYS_REINSTALL_SIGHANDLERS

View file

@ -1907,9 +1907,9 @@ insert_some_chars (string, count, col)
char *string;
int count, col;
{
#ifdef __MSDOS__
#if defined(__MSDOS__) || defined(__MINGW32__)
_rl_output_some_chars (string, count);
#else /* !__MSDOS__ */
#else /* !__MSDOS__ && !__MINGW32__ */
/* DEBUGGING */
if (MB_CUR_MAX == 1 || rl_byte_oriented)
if (count != col)
@ -1959,7 +1959,7 @@ delete_chars (count)
if (count > _rl_screenwidth) /* XXX */
return;
#ifndef __MSDOS__
#if !defined(__MSDOS__) && !defined(__MINGW32__)
if (_rl_term_DC && *_rl_term_DC)
{
char *buffer;
@ -1972,7 +1972,7 @@ delete_chars (count)
while (count--)
tputs (_rl_term_dc, 1, _rl_output_character_function);
}
#endif /* !__MSDOS__ */
#endif /* !__MSDOS__ && !__MINGW32__ */
}
void

View file

@ -50,7 +50,9 @@
#endif
#include <fcntl.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#include <stdio.h>
@ -156,9 +158,11 @@ sh_get_home_dir ()
struct passwd *entry;
home_dir = (char *)NULL;
#ifdef HAVE_GETPWUID
entry = getpwuid (getuid ());
if (entry)
home_dir = entry->pw_dir;
#endif
return (home_dir);
}
@ -172,6 +176,7 @@ int
sh_unset_nodelay_mode (fd)
int fd;
{
#ifdef HAVE_FNCTL
int flags, bflags;
if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
@ -192,6 +197,7 @@ sh_unset_nodelay_mode (fd)
flags &= ~bflags;
return (fcntl (fd, F_SETFL, flags));
}
#endif
return 0;
}

View file

@ -127,7 +127,11 @@ rl_signal_handler (sig)
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
/* Since the signal will not be blocked while we are in the signal
handler, ignore it until rl_clear_signals resets the catcher. */
if (sig == SIGINT || sig == SIGALRM)
if (sig == SIGINT
#ifdef SIGALRM
|| sig == SIGALRM
#endif
)
rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
@ -142,9 +146,13 @@ rl_signal_handler (sig)
case SIGTTOU:
case SIGTTIN:
#endif /* SIGTSTP */
#ifdef SIGALRM
case SIGALRM:
#endif
case SIGTERM:
#ifdef SIGQUIT
case SIGQUIT:
#endif
rl_cleanup_after_signal ();
#if defined (HAVE_POSIX_SIGNALS)
@ -160,7 +168,14 @@ rl_signal_handler (sig)
signal (sig, SIG_ACK);
#endif
/* If we have the POSIX kill function, use it; otherwise, fall
back to the ISO C raise function. (Windows is an example of
a platform that has raise, but not kill.) */
#ifdef HAVE_KILL
kill (getpid (), sig);
#else
raise (sig);
#endif
/* Let the signal that we just sent through. */
#if defined (HAVE_POSIX_SIGNALS)
@ -277,8 +292,11 @@ rl_set_signals ()
{
rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
#ifdef SIGQUIT
rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
#endif
#ifdef SIGALRM
oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
if (oh == (SigHandler *)SIG_IGN)
rl_sigaction (SIGALRM, &old_alrm, &dummy);
@ -290,6 +308,7 @@ rl_set_signals ()
if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#endif /* HAVE_POSIX_SIGNALS */
#endif /* SIGALRM */
#if defined (SIGTSTP)
rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
@ -328,8 +347,12 @@ rl_clear_signals ()
rl_sigaction (SIGINT, &old_int, &dummy);
rl_sigaction (SIGTERM, &old_term, &dummy);
#ifdef SIGQUIT
rl_sigaction (SIGQUIT, &old_quit, &dummy);
#endif
#ifdef SIGALRM
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#endif
#if defined (SIGTSTP)
rl_sigaction (SIGTSTP, &old_tstp, &dummy);

View file

@ -43,7 +43,9 @@
#endif /* HAVE_STDLIB_H */
#include <sys/types.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif /* HAVE_PWD_H */
#include "tilde.h"
@ -53,10 +55,10 @@ static void *xmalloc (), *xrealloc ();
# include "xmalloc.h"
#endif /* TEST || STATIC_MALLOC */
#if !defined (HAVE_GETPW_DECLS)
#if defined (HAVE_GETPWNAM) && !defined (HAVE_GETPW_DECLS)
extern struct passwd *getpwuid PARAMS((uid_t));
extern struct passwd *getpwnam PARAMS((const char *));
#endif /* !HAVE_GETPW_DECLS */
#endif /* defined (HAVE_GETPWNAM) && !HAVE_GETPW_DECLS */
#if !defined (savestring)
#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
@ -347,6 +349,7 @@ tilde_expand_word (filename)
/* No preexpansion hook, or the preexpansion hook failed. Look in the
password database. */
dirname = (char *)NULL;
#ifdef HAVE_GETPWNAM
user_entry = getpwnam (username);
if (user_entry == 0)
{
@ -374,6 +377,7 @@ tilde_expand_word (filename)
}
endpwent ();
#endif
return (dirname);
}