Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!agate!eris.berkeley.edu!mwm From: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) Newsgroups: comp.sys.amiga.tech Subject: Re: What is my name? Message-ID: <26555@agate.BERKELEY.EDU> Date: 21 Jul 89 00:36:05 GMT References: <26385@agate.BERKELEY.EDU> <20565@cup.portal.com> <1227@atanasoff.cs.iastate.edu> <432@xdos.UUCP> <7372@cbmvax.UUCP> <433@xdos.UUCP> Sender: usenet@agate.BERKELEY.EDU Reply-To: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) Organization: Missionaria Phonibalonica Lines: 54 I wish to thank everyone for the comments & help on this topic. I knew the basic algorithm implemented by Doug (thanx, Doug!) before I asked, having done this for Unix. Like I said, this is a nontrivial problem (doing it that way, anyway - I was hoping for a nicer way). To wit, Doug failed to consider a number of cases that cause problems. It's obvious the code won't deal with them, _if_ you know about them. But they aren't obvious cases. Script follows: 1> pwd src:c 1> whence ; correct case src:c 1> /c/whence ; mishandled example 1 /c/ 1> :c/whence ; mishandled example 2 :c/ 1> makedir c:x 1> copy whence c:x/whence 1> x/whence ; mishandled example 3 x/ 1> cd / 1> x/whence ; mishandled example 4 x/ 1> x//x/whence ; mishandled example 5 x//x/ All three are wrong, as the incorrectly give back a relative path. Example 2 is absolute on a device, but doesn't specify the device. For example 3, I'm running WShell; your milage may vary with other shells. Example 5 doesn't matter now - but once the other bugs are fixed, it will. This problem ranks with 'more' as being "one of the worlds hardest single-evening hacks", in that it _looks_ straightforward and simple; it's just that to do either one right, there are lots of non-obvious things you have to deal with. I would be surprised if anyone could sit down and write code that dealt correctly with all the cases in a single evening, unless you've done it before. Note that my examples are pulled from Unix, and there are other gotchas that can't happen on the Amiga. There's one on the list that can't happen on Unix (#2), and there are probably others. That's why I asked before trying to write it myself.