wildcard matching

Doug McDonald mcdonald at aries.scs.uiuc.edu
Sat Jan 5 09:00:37 AEST 1991


>In article <579 at cadlab.sublink.ORG> staff at cadlab.sublink.ORG (Alex Martelli)
>writes:
>> I know that MSDOS and OS/2 consider that, when typing "a*b" or "a*c",
>> the user was just being funny, and he _actually_ meant just "a*" in
>> either case... presumably the extra letter, or letters, having been
>> typed just to keep his or her fingers in exercise?-)
>> 
>> I'm also happy to relate, though, that _other_ operating systems DO
>> have a modicum of common sense in their wildcars semantics!
>> That is, one can use, for example, "a*b" to stand for all files with
>> names beginning with a and ending with b, with anything or nothing in
>> between.  This is true at least in Dec's VMS and IBM's VM/SP (CMS), as
>> well, of course, as in Unix.
>

Apparently the above author does not understand MS-DOS wildcards. MS-DOS
 DOES have more than a "modicum" of common sense in its wild card system.
It is very simple:

A filename has the form abcdefgh.ijk , i.e. one to 8 characters followed
by an optional dot and one to three characters. Wildcards operate
separately in the first and second parts. A "*" is a wildcard that
means "any character in that and any succeeding position". A "?" is a
wildcard that means "any character in just that one position". That
is what the manual says, and that is what MS-DOS itself does. 

For example, a?b means a file with three letters, no extension, and 
a and b in the first and third positions. a?b*.* means a file with a and
b in the first and third places, anything in the second place, and anything
at all in the fourth through 8th positions, and any extension, or no 
extension at all. 

This of course has nothing to do with the C language, except that
some people apparently can't write C programs for MS-DOS that do 
wildcards as they are defined for it.

Doug McDonald



More information about the Comp.lang.c mailing list