Deleted Added
full compact
0a1
> /* $FreeBSD: head/contrib/libreadline/complete.c 58314 2000-03-19 22:00:57Z ache $ */
10c11
< as published by the Free Software Foundation; either version 1, or
---
> as published by the Free Software Foundation; either version 2, or
21c22
< 675 Mass Ave, Cambridge, MA 02139, USA. */
---
> 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
72a74,75
> #include "xmalloc.h"
> #include "rlprivate.h"
74,78c77,81
< extern char *tilde_expand ();
< extern char *rl_copy_text ();
< extern void _rl_abort_internal ();
< extern int _rl_qsort_string_compare ();
< extern void _rl_replace_text ();
---
> #ifdef __STDC__
> typedef int QSFUNC (const void *, const void *);
> #else
> typedef int QSFUNC ();
> #endif
80,87d82
< extern Function *rl_last_func;
< extern int rl_editing_mode;
< extern int screenwidth;
<
< extern void _rl_move_vert ();
< extern int _rl_vis_botlin;
< extern int rl_display_fixed;
<
98,99c93,94
< char *filename_completion_function ();
< char **completion_matches ();
---
> char *filename_completion_function __P((char *, int));
> char **completion_matches __P((char *, CPFunction *));
105c100
< static int stat_char ();
---
> static int stat_char __P((char *));
108,109c103,104
< static char *rl_quote_filename ();
< static char *rl_strpbrk ();
---
> static char *rl_quote_filename __P((char *, int, char *));
> static char *rl_strpbrk __P((char *, char *));
111,116c106,111
< static char **remove_duplicate_matches ();
< static void insert_match ();
< static int append_to_match ();
< static void insert_all_matches ();
< static void display_matches ();
< static int compute_lcd_of_matches ();
---
> static char **remove_duplicate_matches __P((char **));
> static void insert_match __P((char *, int, int, char *));
> static int append_to_match __P((char *, int, int));
> static void insert_all_matches __P((char **, int, char *));
> static void display_matches __P((char **));
> static int compute_lcd_of_matches __P((char **, int, char *));
118,119d112
< extern char *xmalloc (), *xrealloc ();
<
138a132,134
> #if defined (__MSDOS__) && !defined (__DJGPP__)
> int _rl_completion_case_fold = 1;
> #else
139a136
> #endif
419a417,420
> #if defined (__MSDOS__)
> if (rl_filename_completion_desired && temp == 0 && isalpha (pathname[0]) && pathname[1] == ':')
> temp = pathname + 1;
> #endif
480c481,486
< s = tilde_expand (full_pathname);
---
> /* If setting the last slash in full_pathname to a NUL results in
> full_pathname being the empty string, we are trying to complete
> files in the root directory. If we pass a null string to the
> bash directory completion hook, for example, it will expand it
> to the current directory. We just want the `/'. */
> s = tilde_expand (full_pathname && *full_pathname ? full_pathname : "/");
630,638c636,638
< if it is found in rl_completer_word_break_characters. */
< if (rl_char_is_quoted_p)
< isbrk = (found_quote == 0 ||
< (*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
< strchr (rl_completer_word_break_characters, scan) != 0;
< else
< isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
<
< if (isbrk)
---
> if it is found in rl_completer_word_break_characters. Don't bother
> if we're at the end of the line, though. */
> if (scan)
640,643c640,645
< /* If the character that caused the word break was a quoting
< character, then remember it as the delimiter. */
< if (rl_basic_quote_characters && strchr (rl_basic_quote_characters, scan) && (end - rl_point) > 1)
< delimiter = scan;
---
> if (rl_char_is_quoted_p)
> isbrk = (found_quote == 0 ||
> (*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
> strchr (rl_completer_word_break_characters, scan) != 0;
> else
> isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
645,648c647,660
< /* If the character isn't needed to determine something special
< about what kind of completion to perform, then advance past it. */
< if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
< rl_point++;
---
> if (isbrk)
> {
> /* If the character that caused the word break was a quoting
> character, then remember it as the delimiter. */
> if (rl_basic_quote_characters &&
> strchr (rl_basic_quote_characters, scan) &&
> (end - rl_point) > 1)
> delimiter = scan;
>
> /* If the character isn't needed to determine something special
> about what kind of completion to perform, then advance past it. */
> if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
> rl_point++;
> }
718c730
< qsort (matches+1, i-1, sizeof (char *), _rl_qsort_string_compare);
---
> qsort (matches+1, i-1, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
911c923
< qsort (matches + 1, len, sizeof (char *), _rl_qsort_string_compare);
---
> qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
1410c1422
< #if defined (__GO32__) || defined (__WIN32__) || defined (__OPENNT)
---
> #if defined (__WIN32__) || defined (__OPENNT)
1412c1424
< #else /* !__GO32__ */
---
> #else /* !__WIN32__ && !__OPENNT) */
1455c1467
< #endif /* !__GO32__ */
---
> #endif /* !__WIN32__ && !__OPENNT */
1496a1509,1514
> #if defined (__MSDOS__)
> /* special hack for //X/... */
> if (dirname[0] == '/' && dirname[1] == '/' && isalpha (dirname[2]) && dirname[3] == '/')
> temp = strrchr (dirname + 3, '/');
> #endif
>
1501a1520,1527
> #if defined (__MSDOS__)
> /* searches from current directory on the drive */
> else if (isalpha (dirname[0]) && dirname[1] == ':')
> {
> strcpy (filename, dirname + 2);
> dirname[2] = '\0';
> }
> #endif
1663,1667c1689
< {
< for (match_list_index = 0; matches[match_list_index]; match_list_index++)
< free (matches[match_list_index]);
< free (matches);
< }
---
> free_match_list (matches);