[comp.sys.apple2] Parent pointers

Tabakal@UB.CC.UMICH.EDU (09/01/90)

Do standard ProDOS subdirectories have a pointer to their parent 
directory?  Or do they have to scan from root to find it?  It seems
that noone implements the equivalent of a .. parameter when they
implement a change directory command (with the exception of APW).
I've never understood why.  It's very useful when you're hopping
from children to parent to sibling directories.
 
-----------------------------------------------------------------------------
 
    Todd A. Bakal                                All snappy sayings aside,
    U of M Apple User's Group                    !Index will be updated
    Ann Arbor, Michigan                          ASAP or my name's not... 
 
    Internet: Tabakal@ub.cc.umich.edu            FTP: ummts.cc.umich.edu
              Tab@terminator.cc.umich.edu             35.1.1.43   (PC5:)
    UUCP: ...!uunet!ub.cc.umich.edu!tabakal      BITnet: Tabakal@UMICHUB

toddpw@tybalt.caltech.edu (Todd P. Whitesel) (09/05/90)

Tabakal@UB.CC.UMICH.EDU writes:

>Do standard ProDOS subdirectories have a pointer to their parent 
>directory?  Or do they have to scan from root to find it?  It seems
>that noone implements the equivalent of a .. parameter when they
>implement a change directory command (with the exception of APW).
>I've never understood why.  It's very useful when you're hopping
>from children to parent to sibling directories.

They're supposed to, according to the prodos specs.

Has anybody written a decent CD for basic.system yet? I'm sick of PREFIX.
Maybe I should get off my duff and write one after Turbo Binscii is finished.

Todd Whitesel
toddpw @ tybalt.caltech.edu

vw3@cunixf.cc.columbia.edu (Vernon Williams) (09/05/90)

In article <5928366@ub.cc.umich.edu> Tabakal@UB.CC.UMICH.EDU writes:
>Do standard ProDOS subdirectories have a pointer to their parent 
>directory?  Or do they have to scan from root to find it?  It seems
>that noone implements the equivalent of a .. parameter when they
>implement a change directory command (with the exception of APW).

Not entirely true. Don Elton's ECP8 has such a command. It's the \
(backslash) command. Invoking this command sends you up one directory 
level as does ".."

>I've never understood why.  It's very useful when you're hopping
>from children to parent to sibling directories.

I can't imagine why either. It seems that it woulkd be a most helpful
command to have especially in "command line" environments...

[Tod's sig deleted]



+-------------------------------------------------------+--------------------+
|Vernon Williams					| vw3@cunixf         |
|Evening Supervisor/Library Assistant			+--------------------+
|Thomas J. Watson Library of Business and Economics	| 130 Uris Hall      |

gwyn@smoke.BRL.MIL (Doug Gwyn) (09/05/90)

In article <1990Sep5.031342.27820@cunixf.cc.columbia.edu> vw3@cunixf.cc.columbia.edu (Vernon Williams) writes:
>In article <5928366@ub.cc.umich.edu> Tabakal@UB.CC.UMICH.EDU writes:
>>Do standard ProDOS subdirectories have a pointer to their parent 
>>directory?  Or do they have to scan from root to find it?  It seems
>>that noone implements the equivalent of a .. parameter when they
>>implement a change directory command (with the exception of APW).

I've created for my own purposes an implementation of a canonicalizer
for GS/OS pathnames, which I plan to post to the sources group some day.
chdir("..") is implementable simply by trimming off the trailing piece
of the current prefix #0, which is the GS/OS equivalent of UNIX CWD.
By interposing such a canonicalizer in the path taken by an argument
to any filename-driven function, you automatically get UNIX-like path
interpretation for the function.

By the way, I hereby stake out a claim to the external name subspace
matching the regular expression "_Q8Q_*" for my own use in internal
support for UNIX-like C library extensions.  (Unfortunately, there is
no central registry for allocating portions of global name space.)

mattd@Apple.COM (Matt Deatherage) (09/07/90)

In article <5928366@ub.cc.umich.edu> Tabakal@UB.CC.UMICH.EDU writes:
>Do standard ProDOS subdirectories have a pointer to their parent 
>directory?  Or do they have to scan from root to find it?  It seems
>that noone implements the equivalent of a .. parameter when they
>implement a change directory command (with the exception of APW).
>I've never understood why.  It's very useful when you're hopping
>from children to parent to sibling directories.
> 
It's not there for application use, generally -- it's there for the file
system's use.  If you OPEN and READ a directory, you won't ever see the
parent pointers - only if you do block access will you see them, and that
makes you incompatible with AppleShare.

Davex implements a .. directory walking command (which as Doug Gwyn points
out can be done by simply stripping off the last part of any prefix), but
it doesn't work multiply.  (for example, "cd .." works but "cd ../.." doesn't.)


-- 
============================================================================
Matt Deatherage, Apple Computer, Inc. | "The opinions represented here are
Developer Technical Support, Apple II |  not necessarily those of Apple
Group.  Personal mail only, please.   |  Computer, Inc.  Remember that."
============================================================================

scottr@gnh-applesauce.cts.com (Scott Rothstein) (09/10/90)

Find GS+ magazine -- they wrote a CD called Prefixer. 
GS+ -- 615-870-4960
scottr@applesauce.bb.ny