[Winbash-checkins] CVS: winbash/lib/readline complete.c,1.5,1.6
Brought to you by:
enricobrunetta,
xks
From: Enrico B. <enr...@us...> - 2002-03-20 02:09:58
|
Update of /cvsroot/winbash/winbash/lib/readline In directory usw-pr-cvs1:/tmp/cvs-serv16581/lib/readline Modified Files: complete.c Log Message: Added test target to top level Makefile. Aligned code (especially in builtins) to closely resemble the GNU bash 1.14.7 source files. A lot more work needs to be done to clean the source up to make some sense out of this mess. I am confident we'll get there sooner or later :) Index: complete.c =================================================================== RCS file: /cvsroot/winbash/winbash/lib/readline/complete.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- complete.c 11 Mar 2002 14:32:16 -0000 1.5 +++ complete.c 20 Mar 2002 02:09:55 -0000 1.6 @@ -1172,23 +1172,30 @@ { register int c1, c2, si; - if (completion_case_fold) { - for (si = 0; (c1 = to_lower(match_list[i][si])) && (c2 = to_lower(match_list[i + 1][si]));si++) - if (c1 != c2) break; - } - else { - for (si = 0; (c1 = match_list[i][si]) && (c2 = match_list[i + 1][si]);si++) - if (c1 != c2) break; - } - - if (low > si) - low = si; - i++; + if (completion_case_fold) + { + for (si = 0; + (c1 = to_lower(match_list[i][si])) && + (c2 = to_lower(match_list[i + 1][si])); + si++) + if (c1 != c2) break; } - match_list[0] = xmalloc (low + 1); - strncpy (match_list[0], match_list[1], low); - match_list[0][low] = '\0'; - } + else + { + for (si = 0; + (c1 = match_list[i][si]) && + (c2 = match_list[i + 1][si]); + si++) + if (c1 != c2) break; + } + + if (low > si) low = si; + i++; + } + match_list[0] = xmalloc (low + 1); + strncpy (match_list[0], match_list[1], low); + match_list[0][low] = '\0'; + } } else /* There were no matches. */ { @@ -1287,18 +1294,10 @@ { /* Otherwise, if these match up to the length of filename, then it is a match. */ -// if (completion_case_fold){ - if ((to_lower(entry->d_name[0]) == to_lower(filename[0])) && - (((int)D_NAMLEN (entry)) >= filename_len) && - (strincmp (filename, entry->d_name, filename_len) == 0)) - break; -// } -// else { -// if ((entry->d_name[0] == filename[0]) && -// (((int)D_NAMLEN (entry)) >= filename_len) && -// (strncmp (filename, entry->d_name, filename_len) == 0)) -// break; -// } + if ((to_lower(entry->d_name[0]) == to_lower(filename[0])) && + (((int)D_NAMLEN (entry)) >= filename_len) && + (strincmp (filename, entry->d_name, filename_len) == 0)) + break; } } |