[comp.sys.amiga.programmer] WANTED: ""/filename == ./filename

vinsci@nic.funet.fi (Leonard Norrgard) (01/29/91)

As you might have observed, the Amiga notation for the current
directory, "", doesn't denote the current directory anymore if you
append a filename. Strange and weird. I want ""/filename to match
./filename on unix systems. I'll go for any hack adding this.
Looks like a thing that could be useful in sksh as well...
  Anybody have a solution?

-- Leonard

rhialto@cs.kun.nl (Olaf 'Rhialto' Seibert) (01/30/91)

In article <VINSCI.91Jan29030316@nic.nic.funet.fi> vinsci@nic.funet.fi (Leonard Norrgard) writes:
>As you might have observed, the Amiga notation for the current
>directory, "", doesn't denote the current directory anymore if you
>append a filename. Strange and weird. I want ""/filename to match
>./filename on unix systems. I'll go for any hack adding this.
>Looks like a thing that could be useful in sksh as well...
>  Anybody have a solution?

I am afraid that there is no real solution without introducing some new
name that is equivalent to "". This is because the name of the current
directory is not ``quote-quote'', but ``'', the empty name. So if you
append ``/filename'' to the empty string, the result is again ``/filename''.

Note, by the way, that even in Unix the empty name (implicitly)
indicates the current directory, since the name ``.'' which is normally
used for that purpose is usually just a normal directory entry like
any other.

A possible hack would be some handler which intercepts all DOS packets
sent to file systems, interprets all path names in them, rewriting them
into standard notation, and passing them on to the original filesystem.
(The simplest rewrite of a Lock-path pair would be into a Lock on the
intended file or directory and the empty path.) This can certainly
be done, if you take care of all the details which I forgot ;-)

>-- Leonard
--
--
Olaf 'Rhialto' Seibert                               rhialto@cs.kun.nl
How can you be so stupid if you're identical to me? -Robert Silverberg

jap@convex.cl.msu.edu (Joe Porkka) (01/31/91)

rhialto@cs.kun.nl (Olaf 'Rhialto' Seibert) writes:

>In article <VINSCI.91Jan29030316@nic.nic.funet.fi> vinsci@nic.funet.fi (Leonard Norrgard) writes:
>>As you might have observed, the Amiga notation for the current
>>directory, "", doesn't denote the current directory anymore if you
>>append a filename. Strange and weird. I want ""/filename to match
>>./filename on unix systems. I'll go for any hack adding this.
>>Looks like a thing that could be useful in sksh as well...
>>  Anybody have a solution?

>I am afraid that there is no real solution without introducing some new
>name that is equivalent to "". This is because the name of the current
>directory is not ``quote-quote'', but ``'', the empty name. So if you
>append ``/filename'' to the empty string, the result is again ``/filename''.

Of course, under 2.x you can use MakeLink . "" and  MakeLink .. /
to get your . and .. to work.

jesup@cbmvax.commodore.com (Randell Jesup) (01/31/91)

In article <1991Jan30.192631.15514@msuinfo.cl.msu.edu> jap@convex.cl.msu.edu (Joe Porkka) writes:
>Of course, under 2.x you can use MakeLink . "" and  MakeLink .. /
>to get your . and .. to work.

	Just don't do "dir all".  :-(  Many system utilities are only
marginally knowlegable about links at this point, though that will change.
Be careful with links to directories, particularily self-referential ones.
(Unix makes this only usable from super-user mode.)

-- 
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")  ;-)

peter@sugar.hackercorp.com (Peter da Silva) (01/31/91)

In article <VINSCI.91Jan29030316@nic.nic.funet.fi> vinsci@nic.funet.fi (Leonard Norrgard) writes:
> Strange and weird. I want ""/filename to match
> ./filename on unix systems.

Change your thinking. To add a filename to a directory spec just add the
filename:

	""		"filename"
	"/"		"/filename"
	"dev:"		"dev:filename"
	"subdir/"	"subdir/filename"

That last one is where you have to make a breakthrough. It works. Then, to
go back up a level append a slash. It works.

AmigaDOS isn't UNIX, even if it feels like "UNIX LITE".
-- 
Peter da Silva.   `-_-'
<peter@sugar.hackercorp.com>.

mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) (02/01/91)

In article <18354@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
   (Unix makes this only usable from super-user mode.)

I still maintain that this is correct, as soft links will allow for
links to directories without creating the problems associated with
hard links. If hard links to directories wind up in 2.0 and I'm right,
taking them out will be nearly impossible. If I'm wrong and they don't
wind up in 2.0, adding them in later will be easy. For that reason, I
still wish that the facility not be in the ROM version.

Come to think of it, the change doesn't have to be in ROM. If the
MakeLink command won't link to a directory, and the appropriate OS
calls are documented as having unpredictable results if a hard link to
a directory is created, that should be sufficient for the present. A
later WB upgrade can then replace MakeLink if I'm wrong.

	<mike
--
My feet are set for dancing,				Mike Meyer
Won't you turn your music on.				mwm@pa.dec.com
My heart is like a loaded gun,				decwrl!mwm
Won't you let the water run.

new@ee.udel.edu (Darren New) (02/01/91)

In article <18354@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
>Be careful with links to directories, particularily self-referential ones.
>(Unix makes this only usable from super-user mode.)

Or symbolic links to a parent directory.  Which UNIX doesn't handle
very well either.       -- Darren, the bitten one
-- 
--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
----- Network Protocols, Graphics, Programming Languages, 
      Formal Description Techniques (esp. Estelle), Coffee, Amigas -----
              =+=+=+ Let GROPE be an N-tuple where ... +=+=+=