delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/11/03/09:55:23

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <F10D23B02E54D011A0AB0020AF9CEFE988F9AB@lynx.ceddec.com>
From: "Town, Brad" <btown AT ceddec DOT com>
To: "'cygwin AT sources DOT redhat DOT com'" <cygwin AT sources DOT redhat DOT com>
Subject: Case-insensitive globbing (was RE: Cygnus question)
Date: Fri, 3 Nov 2000 09:55:35 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

------_=_NextPart_000_01C045A6.1F430EF0
Content-Type: text/plain

> There are no facilities in cygwin for case insensitive 
> globbing currently
> and I have no plans or desires to add this.  If someone is interested
> (hah) in providing a patch, I'll gladly consider it.
> 
> cgf

"Hah", you say?  That's like a triple-dog dare!

Attached is a patch to glob.c to allow case-insensitive globbing when a
program is run from a Windows shell.  It's nothing special -- one extra
#include and a couple tolowers.

I didn't change the set matching so you would still have a little control
over things:

-----------------------------------------
[C:\]ls a*
arcldr.exe    arcsetup.exe

[C:\]ls A*
arcldr.exe    arcsetup.exe

[C:\]ls [a]*
arcldr.exe    arcsetup.exe

[C:\]ls [A]*
ls: [A]*: No such file or directory

[C:\]bash
bash-2.04$ ls a*
arcldr.exe    arcsetup.exe
bash-2.04$ ls A*
ls: A*: No such file or directory
-----------------------------------------

How do I feel about this patch?  Well, I won't be heartbroken if it's
ignored.

Brad Town  :)


------_=_NextPart_000_01C045A6.1F430EF0
Content-Type: application/octet-stream;
	name="glob.c.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="glob.c.patch"

--- glob.c.orig	Sat Oct 28 01:41:43 2000=0A=
+++ glob.c	Fri Nov  3 09:32:31 2000=0A=
@@ -72,6 +72,7 @@=0A=
 #include <sys/param.h>=0A=
 #include <sys/stat.h>=0A=
 =0A=
+#include <ctype.h>=0A=
 #include <dirent.h>=0A=
 #include <errno.h>=0A=
 #include <glob.h>=0A=
@@ -738,7 +739,7 @@=0A=
 				return(0);=0A=
 			break;=0A=
 		default:=0A=
-			if (*name++ !=3D c)=0A=
+			if (tolower(*name++) !=3D tolower(c))=0A=
 				return(0);=0A=
 			break;=0A=
 		}=0A=


------_=_NextPart_000_01C045A6.1F430EF0
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
------_=_NextPart_000_01C045A6.1F430EF0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019