Wildcard expansion in Turbo C

der Mouse mouse at mcgill-vision.UUCP
Sun Apr 10 09:31:20 AEST 1988


In article <2785 at mmintl.UUCP>, franka at mmintl.UUCP (Frank Adams) writes:
> In article <977 at mcgill-vision.UUCP> mouse at mcgill-vision.UUCP (der Mouse) writes:
>> In article <329 at gen1.UUCP>, bob at gen1.UUCP (Robert Kamins) writes:
>>> In <1282 at nmtsun.nmt.edu>, greg at nmtsun.nmt.edu (Greg Lindhorst) writes:
>>> I have a "glob" routine that does an MS-DOS wild-card expansion.
>>> The trouble with MS-DOS expansion is that you can't easily glob
>>> stuff like "*c" and expect to get files with names like "ab.c".
>> Yes.  And ugh.  One weekend when I had MS-DOS inflicted on me, I
>> started to write a glob routine that behaved sensibly.
> Please don't confuse "what I'm used to" with "sensible".  [points out
> that some think of filesnames as "name" + "type"]

I wasn't making that mistake.  Personally, I prefer the UNIX way, but I
recognize that it is reasonable to treat names as split up in this way.
However, suppose your directory contains

A.C B.C FOOA.C FOOB.C BARA.C BARB.C

and you glob *B.C.  The sensible thing, which VMS and presumably most
systems with name+type filenames do, is to produce B.C FOOB.C BARB.C.
MS-DOS gives you all six .C files.  In fact, any pattern whose name
portion (the part before the dot) begins with a * behaves as if there
were nothing else in the name portion, I can tell.  *This* you surely
do not consider sensible.

					der Mouse

			uucp: mouse at mcgill-vision.uucp
			arpa: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list