Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: chet.ramey@case.edu
Cc: Daniel Jacobowitz <drow@false.org>, Eli Zaretskii <eliz@gnu.org>,
	 bug-readline@gnu.org,  gdb-patches@sources.redhat.com
Subject: Re: PATCH: Readline on MinGW
Date: Fri, 29 Apr 2005 01:51:00 -0000	[thread overview]
Message-ID: <427192CF.6090704@codesourcery.com> (raw)
In-Reply-To: <42714EFC.9020500@case.edu>

[-- Attachment #1: Type: text/plain, Size: 815 bytes --]

Chet Ramey wrote:
>>Eli, just to be clear, you said you "support" the patches I posted (with
>>this exception).  I'm interpreting that as "I hope they go into upstream
>>readline", rather than as "it's OK to check these patches into the GDB
>>repository."  If you actually meant the latter, let me know. :-)
> 
> 
> I only looked at the changes briefly, but they looked fine.  I would
> not, in any case, replace `kill' with `raise' without an autoconf test.
> 
> Unless there's something fatally wrong with the patch, I don't have a
> problem incorporating it into the readline distribution.

Here's a revised version that does not use raise, unless kill is 
unavailable.

Please let me know if there's anything else I need to do.

Thanks,

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

[-- Attachment #2: readline.patch --]
[-- Type: text/plain, Size: 19608 bytes --]

2005-03-28  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.

Index: aclocal.m4
===================================================================
RCS file: /cvs/src/src/readline/aclocal.m4,v
retrieving revision 1.7
diff -c -5 -p -r1.7 aclocal.m4
*** aclocal.m4	27 May 2003 23:29:47 -0000	1.7
--- aclocal.m4	29 Apr 2005 01:30:24 -0000
*************** else
*** 1661,1673 ****
    WCWIDTH_OBJ=
  fi
  AC_SUBST(WCWIDTH_OBJ)
  
  AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
! [AC_TRY_RUN([
! #include <wchar.h>
! int
  main ()
  {
    mbstate_t ps;
    return 0;
  }], bash_cv_have_mbstate_t=yes,  bash_cv_have_mbstate_t=no)])
--- 1661,1673 ----
    WCWIDTH_OBJ=
  fi
  AC_SUBST(WCWIDTH_OBJ)
  
  AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
! [AC_TRY_LINK(
! [#include <wchar.h>],
! [int
  main ()
  {
    mbstate_t ps;
    return 0;
  }], bash_cv_have_mbstate_t=yes,  bash_cv_have_mbstate_t=no)])
Index: complete.c
===================================================================
RCS file: /cvs/src/src/readline/complete.c,v
retrieving revision 1.5
diff -c -5 -p -r1.5 complete.c
*** complete.c	8 Dec 2002 22:31:37 -0000	1.5
--- complete.c	29 Apr 2005 01:30:24 -0000
***************
*** 46,56 ****
--- 46,58 ----
  #include <errno.h>
  #if !defined (errno)
  extern int errno;
  #endif /* !errno */
  
+ #ifdef HAVE_PWD_H
  #include <pwd.h>
+ #endif
  
  #include "posixdir.h"
  #include "posixstat.h"
  
  /* System-specific feature definitions and include files. */
*************** typedef int QSFUNC ();
*** 77,89 ****
  /* Unix version of a hidden file.  Could be different on other systems. */
  #define HIDDEN_FILE(fname)	((fname)[0] == '.')
  
  /* Most systems don't declare getpwent in <pwd.h> if _POSIX_SOURCE is
     defined. */
! #if !defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE)
  extern struct passwd *getpwent PARAMS((void));
! #endif /* !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.
     This function is called instead of actually doing the display.
     It takes three arguments: (char **matches, int num_matches, int max_length)
--- 79,92 ----
  /* Unix version of a hidden file.  Could be different on other systems. */
  #define HIDDEN_FILE(fname)	((fname)[0] == '.')
  
  /* Most systems don't declare getpwent in <pwd.h> if _POSIX_SOURCE is
     defined. */
! #if defined(HAVE_GETPWENT) && \
!     (!defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE))
  extern struct passwd *getpwent PARAMS((void));
! #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.
     This function is called instead of actually doing the display.
     It takes three arguments: (char **matches, int num_matches, int max_length)
*************** rl_username_completion_function (text, s
*** 1660,1679 ****
--- 1663,1686 ----
        username = savestring (&text[first_char_loc]);
        namelen = strlen (username);
        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
      {
        value = (char *)xmalloc (2 + strlen (entry->pw_name));
Index: config.h.in
===================================================================
RCS file: /cvs/src/src/readline/config.h.in,v
retrieving revision 1.5
diff -c -5 -p -r1.5 config.h.in
*** config.h.in	3 Mar 2003 18:52:27 -0000	1.5
--- config.h.in	29 Apr 2005 01:30:24 -0000
***************
*** 20,35 ****
--- 20,41 ----
  /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
  #undef STAT_MACROS_BROKEN
  
  #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
  
  /* Define if you have the mbrtowc function. */
  #undef HAVE_MBRTOWC
***************
*** 41,50 ****
--- 47,65 ----
  #undef HAVE_MEMMOVE
  
  /* 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
  
  /* Define if you have the setenv function.  */
  #undef HAVE_SETENV
***************
*** 88,97 ****
--- 103,115 ----
  #undef HAVE_MEMORY_H
  
  /* 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
  
  /* Define if you have the <stdlib.h> header file.  */
  #undef HAVE_STDLIB_H
Index: configure.in
===================================================================
RCS file: /cvs/src/src/readline/configure.in,v
retrieving revision 1.6
diff -c -5 -p -r1.6 configure.in
*** configure.in	17 Dec 2002 02:52:32 -0000	1.6
--- configure.in	29 Apr 2005 01:30:24 -0000
*************** dnl load up the cross-building cache fil
*** 54,73 ****
  dnl files as necessary
  if test "x$cross_compiling" = "xyes"; then
      case "${host}" in
      *-cygwin*)
  	cross_cache=${srcdir}/cross-build/cygwin.cache
- 	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
   
  if test "x$cross_compiling" = "xyes"; then
    CROSS_COMPILING_FLAG=-DCROSS_COMPILING
  else
--- 54,79 ----
  dnl files as necessary
  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
+ 	unset cross_cache
+     fi
  fi
   
  if test "x$cross_compiling" = "xyes"; then
    CROSS_COMPILING_FLAG=-DCROSS_COMPILING
  else
*************** AC_TYPE_SIZE_T
*** 110,127 ****
  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_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 )
  
  BASH_SYS_SIGNAL_VINTAGE
  BASH_SYS_REINSTALL_SIGHANDLERS
  
  BASH_FUNC_POSIX_SETJMP
--- 116,135 ----
  AC_CHECK_TYPE(ssize_t, int)
  
  AC_HEADER_STAT
  AC_HEADER_DIRENT
  
! 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 \
!                 pwd.h)
  
  BASH_SYS_SIGNAL_VINTAGE
  BASH_SYS_REINSTALL_SIGHANDLERS
  
  BASH_FUNC_POSIX_SETJMP
Index: display.c
===================================================================
RCS file: /cvs/src/src/readline/display.c,v
retrieving revision 1.8
diff -c -5 -p -r1.8 display.c
*** display.c	30 Dec 2003 07:25:18 -0000	1.8
--- display.c	29 Apr 2005 01:30:24 -0000
*************** _rl_clear_screen ()
*** 1905,1917 ****
  static void
  insert_some_chars (string, count, col)
       char *string;
       int count, col;
  {
! #ifdef __MSDOS__
    _rl_output_some_chars (string, count);
! #else  /* !__MSDOS__ */
    /* DEBUGGING */
    if (MB_CUR_MAX == 1 || rl_byte_oriented)
      if (count != col)
        fprintf(stderr, "readline: debug: insert_some_chars: count (%d) != col (%d)\n", count, col);
  
--- 1905,1917 ----
  static void
  insert_some_chars (string, count, col)
       char *string;
       int count, col;
  {
! #if defined(__MSDOS__) || defined(__MINGW32__)
    _rl_output_some_chars (string, count);
! #else  /* !__MSDOS__ && !__MINGW32__ */
    /* DEBUGGING */
    if (MB_CUR_MAX == 1 || rl_byte_oriented)
      if (count != col)
        fprintf(stderr, "readline: debug: insert_some_chars: count (%d) != col (%d)\n", count, col);
  
*************** delete_chars (count)
*** 1957,1967 ****
       int count;
  {
    if (count > _rl_screenwidth)	/* XXX */
      return;
  
! #ifndef __MSDOS__
    if (_rl_term_DC && *_rl_term_DC)
      {
        char *buffer;
        buffer = tgoto (_rl_term_DC, count, count);
        tputs (buffer, count, _rl_output_character_function);
--- 1957,1967 ----
       int count;
  {
    if (count > _rl_screenwidth)	/* XXX */
      return;
  
! #if !defined(__MSDOS__) && !defined(__MINGW32__)  
    if (_rl_term_DC && *_rl_term_DC)
      {
        char *buffer;
        buffer = tgoto (_rl_term_DC, count, count);
        tputs (buffer, count, _rl_output_character_function);
*************** delete_chars (count)
*** 1970,1980 ****
      {
        if (_rl_term_dc && *_rl_term_dc)
  	while (count--)
  	  tputs (_rl_term_dc, 1, _rl_output_character_function);
      }
! #endif /* !__MSDOS__ */
  }
  
  void
  _rl_update_final ()
  {
--- 1970,1980 ----
      {
        if (_rl_term_dc && *_rl_term_dc)
  	while (count--)
  	  tputs (_rl_term_dc, 1, _rl_output_character_function);
      }
! #endif /* !__MSDOS__ && !__MINGW32__ */
  }
  
  void
  _rl_update_final ()
  {
Index: shell.c
===================================================================
RCS file: /cvs/src/src/readline/shell.c,v
retrieving revision 1.4
diff -c -5 -p -r1.4 shell.c
*** shell.c	8 Dec 2002 22:31:37 -0000	1.4
--- shell.c	29 Apr 2005 01:30:24 -0000
***************
*** 48,58 ****
--- 48,60 ----
  #if defined (HAVE_LIMITS_H)
  #  include <limits.h>
  #endif
  
  #include <fcntl.h>
+ #ifdef HAVE_PWD_H
  #include <pwd.h>
+ #endif
  
  #include <stdio.h>
  
  #include "rlstdc.h"
  #include "rlshell.h"
*************** sh_get_home_dir ()
*** 154,166 ****
--- 156,170 ----
  {
    char *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);
  }
  
  #if !defined (O_NDELAY)
  #  if defined (FNDELAY)
*************** sh_get_home_dir ()
*** 170,179 ****
--- 174,184 ----
  
  int
  sh_unset_nodelay_mode (fd)
       int fd;
  {
+ #ifdef HAVE_FNCTL
    int flags, bflags;
  
    if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
      return -1;
  
*************** sh_unset_nodelay_mode (fd)
*** 190,197 ****
--- 195,203 ----
    if (flags & bflags)
      {
        flags &= ~bflags;
        return (fcntl (fd, F_SETFL, flags));
      }
+ #endif
  
    return 0;
  }
Index: signals.c
===================================================================
RCS file: /cvs/src/src/readline/signals.c,v
retrieving revision 1.5
diff -c -5 -p -r1.5 signals.c
*** signals.c	8 Dec 2002 22:31:37 -0000	1.5
--- signals.c	29 Apr 2005 01:30:24 -0000
*************** rl_signal_handler (sig)
*** 125,135 ****
    RL_SETSTATE(RL_STATE_SIGHANDLER);
  
  #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)
      rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
  #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
  
    switch (sig)
      {
--- 125,139 ----
    RL_SETSTATE(RL_STATE_SIGHANDLER);
  
  #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 
! #ifdef SIGALRM
!       || sig == SIGALRM
! #endif
!                        )
      rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
  #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
  
    switch (sig)
      {
*************** rl_signal_handler (sig)
*** 140,152 ****
--- 144,160 ----
  #if defined (SIGTSTP)
      case SIGTSTP:
      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)
        sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
        sigdelset (&set, sig);
*************** rl_signal_handler (sig)
*** 158,168 ****
--- 166,183 ----
  
  #if defined (__EMX__)
        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)
        sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
  #else /* !HAVE_POSIX_SIGNALS */
*************** rl_set_signals ()
*** 275,286 ****
--- 290,304 ----
  
    if (rl_catch_signals && signals_set_flag == 0)
      {
        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);
  #if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
        /* If the application using readline has already installed a signal
*************** rl_set_signals ()
*** 288,297 ****
--- 306,316 ----
  	 automatically, so readline should just get out of the way.  Since
  	 we tested for SIG_IGN above, we can just test for SIG_DFL here. */
        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);
  #endif /* SIGTSTP */
  
*************** rl_clear_signals ()
*** 326,337 ****
--- 345,360 ----
      {
        sigemptyset (&dummy.sa_mask);
  
        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);
  #endif /* SIGTSTP */
  
Index: tilde.c
===================================================================
RCS file: /cvs/src/src/readline/tilde.c,v
retrieving revision 1.4
diff -c -5 -p -r1.4 tilde.c
*** tilde.c	8 Dec 2002 22:31:37 -0000	1.4
--- tilde.c	29 Apr 2005 01:30:24 -0000
***************
*** 41,64 ****
  #else
  #  include "ansi_stdlib.h"
  #endif /* HAVE_STDLIB_H */
  
  #include <sys/types.h>
  #include <pwd.h>
  
  #include "tilde.h"
  
  #if defined (TEST) || defined (STATIC_MALLOC)
  static void *xmalloc (), *xrealloc ();
  #else
  #  include "xmalloc.h"
  #endif /* TEST || STATIC_MALLOC */
  
! #if !defined (HAVE_GETPW_DECLS)
  extern struct passwd *getpwuid PARAMS((uid_t));
  extern struct passwd *getpwnam PARAMS((const char *));
! #endif /* !HAVE_GETPW_DECLS */
  
  #if !defined (savestring)
  #define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
  #endif /* !savestring */
  
--- 41,66 ----
  #else
  #  include "ansi_stdlib.h"
  #endif /* HAVE_STDLIB_H */
  
  #include <sys/types.h>
+ #ifdef HAVE_PWD_H
  #include <pwd.h>
+ #endif /* HAVE_PWD_H */
  
  #include "tilde.h"
  
  #if defined (TEST) || defined (STATIC_MALLOC)
  static void *xmalloc (), *xrealloc ();
  #else
  #  include "xmalloc.h"
  #endif /* TEST || STATIC_MALLOC */
  
! #if defined (HAVE_GETPWNAM) && !defined (HAVE_GETPW_DECLS)
  extern struct passwd *getpwuid PARAMS((uid_t));
  extern struct passwd *getpwnam PARAMS((const char *));
! #endif /* defined (HAVE_GETPWNAM) && !HAVE_GETPW_DECLS */
  
  #if !defined (savestring)
  #define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
  #endif /* !savestring */
  
*************** tilde_expand_word (filename)
*** 345,354 ****
--- 347,357 ----
      }
  
    /* 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)
      {
        /* If the calling program has a special syntax for expanding tildes,
  	 and we couldn't find a standard expansion, then let them try. */
*************** tilde_expand_word (filename)
*** 372,381 ****
--- 375,385 ----
        free (username);
        dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
      }
  
    endpwent ();
+ #endif
    return (dirname);
  }
  
  \f
  #if defined (TEST)

  parent reply	other threads:[~2005-04-29  1:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-28  6:53 Mark Mitchell
2005-04-28 20:09 ` Eli Zaretskii
2005-04-28 20:12   ` Daniel Jacobowitz
2005-04-28 20:45     ` Mark Mitchell
2005-04-28 21:02       ` Chet Ramey
2005-04-29  0:44         ` Mark Mitchell
2005-04-29  7:31           ` Eli Zaretskii
2005-04-29 16:10             ` Christopher Faylor
2005-04-29  1:51         ` Mark Mitchell [this message]
2005-04-28 21:02       ` Eli Zaretskii
2005-04-28 20:50     ` Eli Zaretskii
2005-04-28 21:17       ` Daniel Jacobowitz
2005-04-28 22:13         ` Andreas Schwab
2005-04-29  6:59         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=427192CF.6090704@codesourcery.com \
    --to=mark@codesourcery.com \
    --cc=bug-readline@gnu.org \
    --cc=chet.ramey@case.edu \
    --cc=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox