Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!psuvax1!rutgers!otello!gear!cadlab!staff From: staff@cadlab.sublink.ORG (Alex Martelli) Newsgroups: comp.lang.c Subject: Re: wildcard matching Message-ID: <579@cadlab.sublink.ORG> Date: 1 Jan 91 20:09:15 GMT References: <4739.277BA2FB@urchin.fidonet.org> Organization: CAD.LAB, Bologna, Italia Lines: 35 Tony.Bielobockie@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@cadlab.sublink.org, (home:) alex@am.sublink.org Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434; Fax: ++39 (51) 366964 (work only), Fidonet: 332/401.3 (home only).