This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Fix to readline for case-insensitive file-name completion



Geoffrey,

I found the case-sensitive file-name completion in bash unuseable in
Windows, because one often doesn't know the case of names in advance.
So I changed it to case-insensitive by adding a few lines to

		bash/lib/readline/complete.c

I'd like to propose that this feature be integrated into the next
release of Cygnus Win32.

I suppose I should have put the change inside an "#ifdef MSDO" or something,
but you can do that when integrating it.  The changes are very
small so I've appended it as a context diff to the end of this message.

Please let me know if you want this contribution in a different format.
Thanks.

Michael Condict			m.condict@opengroup.org
The Open Group Research Inst.	(617) 621-7349
11 Cambridge Center
Cambridge, MA 02142

--------- changes to src/user-tools/bash/lib/readline/complete.c ----------

*** complete.c	Mon May 19 13:34:16 1997
--- complete.c.ORIG	Mon May 19 13:32:04 1997
***************
*** 1077,1083 ****
  /* **************************************************************** */
  
  /* Non-zero means that case is not significant in completion. */
! int completion_case_fold = 1;
  
  /* Return an array of (char *) which is a list of completions for TEXT.
     If there are no completions, return a NULL pointer.
--- 1077,1083 ----
  /* **************************************************************** */
  
  /* Non-zero means that case is not significant in completion. */
! int completion_case_fold = 0;
  
  /* Return an array of (char *) which is a list of completions for TEXT.
     If there are no completions, return a NULL pointer.
***************
*** 1265,1293 ****
  	{
  	  /* Otherwise, if these match up to the length of filename, then
  	     it is a match. */
! 	  if (completion_case_fold)
! 	    {
! 	      if (((int)D_NAMLEN (entry)) >= filename_len)
! 		{
! 		  register int c1, c2, si;
! 
! 		  for (si = 0; si < filename_len; si++)
! 		    {
! 		      c1 = to_lower(entry->d_name[si]);
! 		      c2 = to_lower(filename[si]);
! 		      if (c1 != c2) break;
! 		    }
! 		  if (si == filename_len)
! 		    break;
! 		}
! 	    }
! 	  else
! 	    {
! 	      if ((entry->d_name[0] == filename[0]) &&
! 		  (((int)D_NAMLEN (entry)) >= filename_len) &&
! 		  (strncmp (filename, entry->d_name, filename_len) == 0))
! 		break;
! 	    }
  	}
      }
  
--- 1265,1274 ----
  	{
  	  /* Otherwise, if these match up to the length of filename, then
  	     it is a match. */
! 	    if ((entry->d_name[0] == filename[0]) &&
! 		(((int)D_NAMLEN (entry)) >= filename_len) &&
! 		(strncmp (filename, entry->d_name, filename_len) == 0))
! 	      break;
  	}
      }
  
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]