Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!usenet.ins.cwru.edu!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!netserv2!deven From: deven@rpi.edu (Deven T. Corzine) Newsgroups: comp.sys.amiga.tech Subject: Re: Wildcards Message-ID: Date: 19 Mar 90 12:15:39 GMT References: <102618@linus.UUCP> <5405@sugar.hackercorp.com> Organization: Rensselaer Polytechnic Institute, Troy, NY Lines: 79 In-Reply-To: peter@sugar.hackercorp.com's message of 18 Mar 90 18:55:35 GMT In article <102618@linus.UUCP> duncant@mbunix.mitre.org (Thomson) writes: Thomson> I am surprised at the use of the phrase "more powerful Thomson> amiga-style wildcards". More powerful than what? On 18 Mar 90 18:55:35 GMT, peter@sugar.hackercorp.com (Peter da Silva) said: Peter> Suppose you want to match all file names ending with .c, .h, or Peter> .bak, and beginning with an underscore or "ck" or containing Peter> the string "test". Peter> In UNIX, you have to use several expressions: Peter> _*.[ch] _*.bak ck*.[ch] ck*.bak *test*.[ch] *test*.bak For csh users: {_,ck,*test}*.{[ch],bak} Peter> On the Amiga, you have a single expression: Peter> ((_|ck)#?|#?test#?).(c|h|bak) Peter> The Amiga wildcards are more complex, but they're also a lot Peter> more powerful. AmigaDOS's (x|y|z) syntax is directly analogous to csh's {x,y,z}. Thomson> I never understood where the AmigaDos wildcard conventions Thomson> came from. Peter> The syntax is unconventional, but the use of a closure rather Peter> than a wildcard has been around for a long time. Granted, AmigaDOS wildcards are flexible and powerful, but I find them less convenient to use than Unix wildcards, under most circumstances. While it is mor flexible to be able to match foo and foooo with f#o, it's not something I find myself using on any regular basis. What is more difficult, for example, is the fact that the copy program only accepts a single source and single destination argument. Yes, you can do "copy (foo|bar|baz) dir" instead of "copy foo bar baz dir", but the former notation is more cumbersome to type, and introduces another disadvantage, namely that it is a _wildcard_. This means the entire directory must be scanned for matches. You lose the speed advantage of the hashed directory lookups, and pay the penalty for a directory scan, even if you know exactly what files you want to copy. The only way to avoid this is to run the copy program once for each program to be copied. This is also inconvenient. The problem is most noticable if you want to copy a half dozen or so files from a LARGE directory on a floppy. My C: directory takes on the order of 20-30 seconds to scan (maybe longer) and it should not be necessary for a simple list of files. I realize that this problem can be solved by using a different copy program which accepts arguments in a fashion more like that of Unix cp. That's not the point. The point is that in _practice_, the flexible wildcards which AmigaDOS offer are not necessarily the boon they may seem. They are awkward to use, and can shift focus from some strengths of AmigaDOS (hashed lookups) to some weaknesses (directory scans). As for solutions, accepting multiple filename arguments instead of a single one in places like the copy program would be an improvement. In response to Dave Haynie's note that "*" has special meaning to AmigaDOS: point taken. But there are times it can be determined from context whether "*" should be the console or a wildcard. Of course, there are situations where it is indeterminable. Offering the user a configurable option of whether or not to treat "*" as a wildcard, and permit it to be escaped with \ or even *. That is, in a wildcard context, treat "*" as "#?" and "**" as "*". Thoughts? Deven -- Deven T. Corzine Internet: deven@rpi.edu, shadow@pawl.rpi.edu Snail: 2151 12th St. Apt. 4, Troy, NY 12180 Phone: (518) 274-0327 Bitnet: deven@rpitsmts, userfxb6@rpitsmts UUCP: uunet!rpi!deven Simple things should be simple and complex things should be possible.