wildcard matching

Alex Martelli staff at cadlab.sublink.ORG
Wed Jan 2 07:09:15 AEST 1991


Tony.Bielobockie at urchin.fidonet.org (Tony Bielobockie) writes:

>To: Alex Martelli
> 
>AM> Optimizing this, and in particular eliminating the recursive call,
>AM> is, on the other hand, a rather interesting exercise, but one I'd
>AM> undertake only if wildcard-matching was proven-by-profiling to be
>AM> a bottleneck in my application... which is rather unlikely, I think.
> 
>I think that the recursive call is unnessicary.  Consider that anything
>trailing the '*' character is ignored anyway, at least in MS-DOS, and
>OS/2. What need is there for further checking if a '*' character is
>encountered?  Does that hold true in the UNIX would too?

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.

If you write your own subroutines for matching with wildcards, you
can of course offer whatever semantics strike your fancy.  I can
hardly believe anybody would care to defend the absurd semantics
of MessyDOS in this respect, though!
-- 
Alex Martelli - CAD.LAB s.p.a., v. Stalingrado 53, Bologna, Italia
Email: (work:) staff at cadlab.sublink.org, (home:) alex at am.sublink.org
Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434; 
Fax: ++39 (51) 366964 (work only), Fidonet: 332/401.3 (home only).



More information about the Comp.lang.c mailing list