Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!ux1.cso.uiuc.edu!aries!mcdonald From: mcdonald@aries.scs.uiuc.edu (Doug McDonald) Newsgroups: comp.lang.c Subject: Re: wildcard matching Message-ID: <1991Jan4.220037.3790@ux1.cso.uiuc.edu> Date: 4 Jan 91 22:00:37 GMT References: <4739.277BA2FB@urchin.fidonet.org> <579@cadlab.sublink.ORG> <1991Jan4.095351.12412@tsa.co.uk> Sender: news@ux1.cso.uiuc.edu (News) Organization: School of Chemical Sciences, Univ. of Illinois at Urbana-Champaign Lines: 37 >In article <579@cadlab.sublink.ORG> staff@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