jesup@cbmvax.commodore.com (Randell Jesup) (01/22/91)
In article <04348.AA04348@ami-cg.UUCP> cg@ami-cg.UUCP (Chris Gray) writes: >I recall hearing that the 2.0 DOS pattern matcher handles the '~' operator >to mean 'not'. I vaguely recall someone saying that it was easy to add. >Well, I took a quick try and it didn't work out. Could someone send me >the changes necessary to add the '~' to one of the versions of the matcher >that was floating around? Thanks. It does support it (though earlier versions of 2.0 had a few problems with ~, it works very well now). Are you talking about some package? It's not clear from your message. The trick to implementing ~ is to consider it to be #? if the pattern "not-ed" doesn't match. I.e ~a matches all files that are not exactly "a", not just 1-character files that are not "a". The easiest implementation is to have a not-end token, and call the matcher recursively on the not-ed part. the not-end token will cause the match routine to return immediately success, regardless if the strings have not all been used yet. If the recursive call matches, kick out with an error, else go to the routine which handles #?. -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)
rosenber@ra.abo.fi (Robin Rosenberg INF) (01/24/91)
While on the subject; How do I delete files that end with a '~', mg3 and gnuemacs creates backup files ending with a tilde. Under 2.02 i could use delete #?[~] and it did the job. Under 2.03 it deletes all files (thanks). Q2: Is it possible to delete files that match a pattern except for the files that match another pattern (with the delete command)? ---- Robin
dac@prolix.ccadfa.oz.au (Andrew Clayton) (01/25/91)
In article <ROSENBER.91Jan24163004@ra.abo.fi>, Robin Rosenberg INF writes: > > While on the subject; How do I delete files that end with a '~', mg3 > and gnuemacs creates backup files ending with a tilde. Under 2.02 i could use > delete #?[~] and it did the job. Under 2.03 it deletes all files (thanks). Does delete #?*~ work? Or doesn't "*" mean 'ignore special meaning of the following character' under 2.0x? I don't have Amigados 2.0x to work with and under 1.3.2 files with a '~' in them aren't a hassle. Dac -- _l _ _ // Andrew Clayton. Canberra, Australia. I Post . (_](_l(_ \X/ ccadfa.cc.adfa.oz.au!prolix!dac . . I am. -------- I cannot send or receive email. Not to anyone at all. Not even you.
andy@cbmvax.commodore.com (Andy Finkel) (01/26/91)
In article <ROSENBER.91Jan24163004@ra.abo.fi> rosenber@ra.abo.fi (Robin Rosenberg INF) writes: > >While on the subject; How do I delete files that end with a '~', mg3 >and gnuemacs creates backup files ending with a tilde. Under 2.02 i could use >delete #?[~] and it did the job. Under 2.03 it deletes all files (thanks). You need to escape the ~ character. To escape a wildcard, you preceed it with a ' (single quote) to delete all the files ending with ~ you say delete #?`~ The fact that #?[~] deleted everything is a bug. andy -- andy finkel {uunet|rutgers|amiga}!cbmvax!andy Commodore-Amiga, Inc. "God was able to create the world in only seven days because there was no installed base to consider." Any expressed opinions are mine; but feel free to share. I disclaim all responsibilities, all shapes, all sizes, all colors.
jesup@cbmvax.commodore.com (Randell Jesup) (01/26/91)
In article <ROSENBER.91Jan24163004@ra.abo.fi> rosenber@ra.abo.fi (Robin Rosenberg INF) writes: > >While on the subject; How do I delete files that end with a '~', mg3 >and gnuemacs creates backup files ending with a tilde. Under 2.02 i could use >delete #?[~] and it did the job. Under 2.03 it deletes all files (thanks). Here we go again. Currently we have not released anything called 2.03 (last time it was 2.04 someone was reporting things from). We may do so, and developers may (or may not) have what will be called 2.03 if and when it is released. (How's that for not saying much with a lot of words? ;-) For beta versions, we refer to them by the version numbers, as reported by "version" or the version menu item in WB. There was supposed to be a specific hack in the patternmatch code to do something special with a final ~. Certainly it shouldn't silently eat it (VERY bad). I'll look into it; in the meantime you can use "delete #?'~" (tick (') makes the next wildcard non-special). Try it in a test directory first, though, just for safety. BTW, bugs like this are one of the reasons why we don't want non- developers playing with betatest kickstarts. >Q2: Is it possible to delete files that match a pattern except for the >files that match another pattern (with the delete command)? I think you have to "merge" the patterns. example: #?.c but not adsf.c -> ~(asdf).c ab#?.c but not ab#c.c -> ab~(#c).c Trying to do tricky things with patterns can be mind-warping (much like with Unix RE's). -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)
bruce@zuhause.MN.ORG (Bruce Albrecht) (01/28/91)
>In article <ROSENBER.91Jan24163004@ra.abo.fi> rosenber@ra.abo.fi (Robin Rosenberg INF) writes: > >While on the subject; How do I delete files that end with a '~', mg3 >and gnuemacs creates backup files ending with a tilde. Under 2.02 i could use >delete #?[~] and it did the job. Under 2.03 it deletes all files (thanks). delete #?'~ -- bruce@zuhause.mn.org
swalton@solaria.csun.edu (Stephen Walton) (01/30/91)
In article <18132@cbmvax.commodore.com>, jesup@cbmvax (Randell Jesup) writes: > There was supposed to be a specific hack in the patternmatch code >to do something special with a final ~. Certainly it shouldn't silently >eat it (VERY bad). I'll look into it; I agree with Randell's later comment that regular expressions can be mind warping. However, the behavior of the final ~ is consistent, I think. Since ~ NOT's the following expression, the string #?~ matches everything (that is, it matches all file names which consist of any string followed by not-the-null-string). The best fix is probably to modify Emacs-ish editors to use a different backup scheme so they don't collide with an Amiga wildcard character. After all, you wouldn't end your backups on Unix with an asterisk, would you :-) ? Steve
daveh@cbmvax.commodore.com (Dave Haynie) (01/31/91)
In article <1991Jan29.172553.421@csun.edu> swalton@solaria.csun.edu (Stephen Walton) writes: >However , the behavior of the final ~ is consistent, I think. Since ~ NOT's >the following expression, the string #?~ matches everything (that is, it >matches all file names which consist of any string followed by >not-the-null-string). Operators like # and ~ always have to have a target character or expression to operate on, at least according to the original pattern matching rules. The end-of-line isn't an implied NUL character, or at least, it shouldn't be. We have an explicit NUL metacharacter, %, for use in AmigaDOS patterns. >Steve -- Dave Haynie Commodore-Amiga (Amiga 3000) "The Crew That Never Rests" {uunet|pyramid|rutgers}!cbmvax!daveh PLINK: hazy BIX: hazy "What works for me might work for you" -Jimmy Buffett
vinsci@nic.funet.fi (Leonard Norrgard) (01/31/91)
In article <18313@cbmvax.commodore.com> daveh@cbmvax.commodore.com (Dave Haynie) writes: In article <1991Jan29.172553.421@csun.edu> swalton@solaria.csun.edu (Stephen Walton) writes: >However , the behavior of the final ~ is consistent, I think. Since ~ NOT's >[...] [...] We have an explicit NUL metacharacter, %, for use in AmigaDOS patterns. Thanks Dave! You just provided a solution for another problem! I posted a message the other day requesting an AmigaDOS equivalence for the unix ./filename to denote a file in the current directory (as opposed to a file somewhere in the path). It turns out that %/filename works just great, at least on this version of 2.0. Ie. in a directoy called `tmp': list filename list %/filename list /tmp/%/filename all produce the expected result, corresponding to the following unix ones: ls -l filename ls -l ./filename ls -l ../tmp/./filename Dave Haynie Commodore-Amiga (Amiga 3000) "The Crew That Never Rests" Many thanks! (Randell, why didn't you tell us ;-) !) -- Leonard
jesup@cbmvax.commodore.com (Randell Jesup) (01/31/91)
In article <VINSCI.91Jan31064653@nic.nic.funet.fi> vinsci@nic.funet.fi (Leonard Norrgard) writes: >Ie. in a directoy called `tmp': > > list filename > list %/filename > list /tmp/%/filename > >all produce the expected result, corresponding to the following unix ones: > > ls -l filename > ls -l ./filename > ls -l ../tmp/./filename > > > Dave Haynie Commodore-Amiga (Amiga 3000) "The Crew That Never Rests" > >Many thanks! (Randell, why didn't you tell us ;-) !) Because that only currently works with programs that find files via MatchFirst/MatchNext (where % is implemented). However, almost all programs we supply now go through it (even CD I think). It does NOT work with Open(), Lock(), etc. I will, however, add it to the enhancements list (it sounds like a usable idea). Don't hold your breath, it's too late for the next OS update. Also, I hadn't tested that usage myself. I have worked hard to try to get the pattern-matching close to right for this release. ;-) -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)
rwm@atronx.OCUnix.On.Ca (Russell McOrmond) (02/01/91)
In a message posted on 31 Jan 91 08:38:01 GMT, jesup@cbmvax.commodore.com (Randell Jesup) wrote: RJ> Also, I hadn't tested that usage myself. I have worked hard to RJ>try to get the pattern-matching close to right for this release. ;-) BTW, Thank you VERY much for allowing such easy access to these routines for the rest of us. I have added parttern matching to places where I would normally have not bothered (IE: In a Username field for a Login, etc) that have come in VERY handy in a lot of situations. RJ>Randell Jesup, Keeper of AmigaDos, Commodore Engineering. RJ>{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup --- Opinions expressed in this message are my Own. I represent nobody else. Russell McOrmond rwm@Atronx.OCUnix.On.Ca {tigris,alzabo,...}!atronx!rwm FidoNet 1:163/109 Net Support: (613) 230-2282 Amiga-Fidonet Support 1:1/109 Gateway for .Amiga.OCUnix.On.Ca