1,2c1
< /* $FreeBSD: head/contrib/libreadline/complete.c 136758 2004-10-21 20:02:02Z peter $ */
<
---
> /* $FreeBSD: head/contrib/libreadline/complete.c 157188 2006-03-27 23:11:32Z ache $ */
5c4
< /* Copyright (C) 1987-2004 Free Software Foundation, Inc.
---
> /* Copyright (C) 1987-2005 Free Software Foundation, Inc.
52a52
> #if defined (HAVE_PWD_H)
53a54
> #endif
84c85
< #if !defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE)
---
> #if defined (HAVE_GETPWENT) && (!defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE))
86c87
< #endif /* !HAVE_GETPW_DECLS || _POSIX_SOURCE */
---
> #endif /* HAVE_GETPWENT && (!HAVE_GETPW_DECLS || _POSIX_SOURCE) */
211c212,213
< she is sure she wants to see them all. */
---
> she is sure she wants to see them all. A negative value means
> don't ask. */
625a628,629
> int width, w;
> wchar_t wc;
658c662
< tlen = mbrlen (s, end - s, &ps);
---
> tlen = mbrtowc (&wc, s, end - s, &ps);
661a666
> width = 1;
665a671,675
> else
> {
> w = wcwidth (wc);
> width = (w >= 0) ? w : 1;
> }
667a678
> printed_len += width;
671d681
< #endif
672a683
> #endif
688c699
< char *s, c, *new_full_pathname;
---
> char *s, c, *new_full_pathname, *dn;
713c724,734
< s = tilde_expand (full_pathname && *full_pathname ? full_pathname : "/");
---
> if (full_pathname == 0 || *full_pathname == 0)
> dn = "/";
> else if (full_pathname[0] != '/')
> dn = full_pathname;
> else if (full_pathname[1] == 0)
> dn = "//"; /* restore trailing slash to `//' */
> else if (full_pathname[1] == '/' && full_pathname[2] == 0)
> dn = "/"; /* don't turn /// into // */
> else
> dn = full_pathname;
> s = tilde_expand (dn);
720a742,745
> if (s[slen - 1] == '/')
> slen--;
> else
> new_full_pathname[slen] = '/';
812,819c837
< #if defined (HANDLE_MULTIBYTE)
< for (scan = pass_next = 0; scan < end;
< scan = ((MB_CUR_MAX == 1 || rl_byte_oriented)
< ? (scan + 1)
< : _rl_find_next_mbchar (rl_line_buffer, scan, 1, MB_FIND_ANY)))
< #else
< for (scan = pass_next = 0; scan < end; scan++)
< #endif
---
> for (scan = pass_next = 0; scan < end; scan = MB_NEXTCHAR (rl_line_buffer, scan, 1, MB_FIND_ANY))
869,873c887
< #if defined (HANDLE_MULTIBYTE)
< while (rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_ANY))
< #else
< while (--rl_point)
< #endif
---
> while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
1156c1170
< dtext = (*rl_filename_dequoting_function) (text, rl_completion_quote_character);
---
> dtext = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character);
1402c1416
< if (len >= rl_completion_query_items)
---
> if (rl_completion_query_items > 0 && len >= rl_completion_query_items)
1539c1553
< if (_rl_complete_mark_directories)
---
> if (_rl_complete_mark_directories /* && rl_completion_suppress_append == 0 */)
1852a1867
> #if defined (HAVE_GETPWENT)
1858a1874
> #endif
1861a1878
> #if defined (HAVE_GETPWENT)
1862a1880
> #endif
2174c2192
< match_list_index = (match_list_index + count) % match_list_size;
---
> match_list_index += count;
2176a2195,2196
> else
> match_list_index %= match_list_size;
< /* $FreeBSD: head/contrib/libreadline/complete.c 136758 2004-10-21 20:02:02Z peter $ */
<
---
> /* $FreeBSD: head/contrib/libreadline/complete.c 157188 2006-03-27 23:11:32Z ache $ */
5c4
< /* Copyright (C) 1987-2004 Free Software Foundation, Inc.
---
> /* Copyright (C) 1987-2005 Free Software Foundation, Inc.
52a52
> #if defined (HAVE_PWD_H)
53a54
> #endif
84c85
< #if !defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE)
---
> #if defined (HAVE_GETPWENT) && (!defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE))
86c87
< #endif /* !HAVE_GETPW_DECLS || _POSIX_SOURCE */
---
> #endif /* HAVE_GETPWENT && (!HAVE_GETPW_DECLS || _POSIX_SOURCE) */
211c212,213
< she is sure she wants to see them all. */
---
> she is sure she wants to see them all. A negative value means
> don't ask. */
625a628,629
> int width, w;
> wchar_t wc;
658c662
< tlen = mbrlen (s, end - s, &ps);
---
> tlen = mbrtowc (&wc, s, end - s, &ps);
661a666
> width = 1;
665a671,675
> else
> {
> w = wcwidth (wc);
> width = (w >= 0) ? w : 1;
> }
667a678
> printed_len += width;
671d681
< #endif
672a683
> #endif
688c699
< char *s, c, *new_full_pathname;
---
> char *s, c, *new_full_pathname, *dn;
713c724,734
< s = tilde_expand (full_pathname && *full_pathname ? full_pathname : "/");
---
> if (full_pathname == 0 || *full_pathname == 0)
> dn = "/";
> else if (full_pathname[0] != '/')
> dn = full_pathname;
> else if (full_pathname[1] == 0)
> dn = "//"; /* restore trailing slash to `//' */
> else if (full_pathname[1] == '/' && full_pathname[2] == 0)
> dn = "/"; /* don't turn /// into // */
> else
> dn = full_pathname;
> s = tilde_expand (dn);
720a742,745
> if (s[slen - 1] == '/')
> slen--;
> else
> new_full_pathname[slen] = '/';
812,819c837
< #if defined (HANDLE_MULTIBYTE)
< for (scan = pass_next = 0; scan < end;
< scan = ((MB_CUR_MAX == 1 || rl_byte_oriented)
< ? (scan + 1)
< : _rl_find_next_mbchar (rl_line_buffer, scan, 1, MB_FIND_ANY)))
< #else
< for (scan = pass_next = 0; scan < end; scan++)
< #endif
---
> for (scan = pass_next = 0; scan < end; scan = MB_NEXTCHAR (rl_line_buffer, scan, 1, MB_FIND_ANY))
869,873c887
< #if defined (HANDLE_MULTIBYTE)
< while (rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_ANY))
< #else
< while (--rl_point)
< #endif
---
> while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
1156c1170
< dtext = (*rl_filename_dequoting_function) (text, rl_completion_quote_character);
---
> dtext = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character);
1402c1416
< if (len >= rl_completion_query_items)
---
> if (rl_completion_query_items > 0 && len >= rl_completion_query_items)
1539c1553
< if (_rl_complete_mark_directories)
---
> if (_rl_complete_mark_directories /* && rl_completion_suppress_append == 0 */)
1852a1867
> #if defined (HAVE_GETPWENT)
1858a1874
> #endif
1861a1878
> #if defined (HAVE_GETPWENT)
1862a1880
> #endif
2174c2192
< match_list_index = (match_list_index + count) % match_list_size;
---
> match_list_index += count;
2176a2195,2196
> else
> match_list_index %= match_list_size;