From: curtis AT pdi DOT com (Curtis Galloway) Subject: Bash diffs for better filename completion 23 Apr 1997 11:31:09 -0700 Sender: mail AT cygnus DOT com Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <335E28AF.5F6B0D35.cygnus.gnu-win32@pdi.com> X-Mailer: Mozilla 4.0b3 [en] (WinNT; I) MIME-Version: 1.0 Original-To: gnu-win32 AT cygnus DOT com X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Original-Sender: owner-gnu-win32 AT cygnus DOT com Here are some short diffs for bash in beta17.1 that make life a little nicer. It modifies the globbing and filename completion code to work better with Windows' case-preserving but case-insensitive filesystem. It also allows running *.com files in your path. --Curtis Galloway *** /src/cygnus/gnu-win32/gnu-win32-b17.1/bash/execute_cmd.c Tue Dec 03 18:38:30 1996 --- execute_cmd.c Thu Mar 20 08:41:45 1997 *************** *** 3373,3381 **** res = find_user_command_internal_1 (dotexe, flags); if (!res) { ! free (dotexe); ! res = find_user_command_internal_1 (name, flags); } return res; #else return find_user_command_internal_1 (name, flags); --- 3373,3387 ---- res = find_user_command_internal_1 (dotexe, flags); if (!res) { ! /* Now try with a .com suffix */ ! strcpy(dotexe, name); ! strcat (dotexe, ".com"); ! res = find_user_command_internal_1 (dotexe, flags); ! if (!res) { ! res = find_user_command_internal_1 (name, flags); ! } } + free (dotexe); return res; #else return find_user_command_internal_1 (name, flags); *** /src/cygnus/gnu-win32/gnu-win32-b17.1/bash/lib/glob/fnmatch.c Tue Dec 03 18:39:22 1996 --- lib/glob/fnmatch.c Thu Mar 20 08:53:04 1997 *************** *** 175,182 **** --- 175,187 ---- break; default: + #ifdef _WIN32 + if (tolower(c) != tolower(*n)) + return (FNM_NOMATCH); + #else if (c != *n) return (FNM_NOMATCH); + #endif } ++n; *** /src/cygnus/gnu-win32/gnu-win32-b17.1/bash/lib/readline/complete.c Tue Dec 03 18:39:34 1996 --- lib/readline/complete.c Tue Mar 25 08:35:43 1997 *************** *** 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. --- 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. *************** *** 1263,1274 **** --- 1263,1283 ---- } else { + #ifdef _WIN32 + /* Otherwise, if these match up to the length of filename, then + it is a match. */ + if ((tolower(entry->d_name[0]) == tolower(filename[0])) && + (((int)D_NAMLEN (entry)) >= filename_len) && + (strncasecmp (filename, entry->d_name, filename_len) == 0)) + break; + #else /* 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; + #endif } } - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".