[Coco] Nitros9/Scripts question
Gene Heskett
gheskett at wdtv.com
Wed Dec 10 06:33:53 EST 2014
On Tuesday 09 December 2014 22:38:42 Kandur did opine
And Gene did reply:
> Or in Linux called symlinks.
>
> Kandur
Or in os9, much easier to do. But no one has ever written the utility to
do it.
For os9, if you look at the del code, you will find it first decrements
the link byte in the files file descriptor sector and if that byte is then
zero, it will then rewrite the directory entry with a zero'd first byte of
the name AND, using the FD data, clear the FAT bits associated with the
file. However, if its >1, only the directory entry is cleared.
From that it can be deduced that if we wanted a link created, all we have
to do is grab the $20 bytes of that directory entry, and add it to the
directory where it is wanted, AND increment that link count byte in the
FD.
I did it by hand using mostly dEd 15 years ago, at one point I had 5 such
"links"
But I never got around to writing it. It didn't seem to be something that
people were clamoring for. Our world view os os9 today is I think, wide
enough to need/accept such.
We have a "link" utility but that is not its function. In linux its ln,
usually used with the -s option to create a "softlink" which functions as
an alias redirect I believe, but the file itself can be rm'd out from
under the softlink. And while I haven't tested the variety of link called
a hardlink, I get the impression that when a hardlink is rm'd, the file is
truly gone but may leave what are then unresolved directory entries
visible in other directory locations.
I rather like the way os9 handles it. The file itself was not deleted
until that link count byte in the FD was zero. Otherwise it only
disappeared from the directory path you were in, or specified in the del
command. The nice thing about that is that you would have to know where
each such "link" lived because just redoing the del from that directory
gets you a E$FNF, so you can't just sit there type del until you have
defeated the link count because its no longer there in that directory
after the first invocation.
This would be the os9 equ of the linux $PATH environment variable, and
having that set correctly in ones .bashrc script makes lots of stuff a lot
easier to do.
In fact that might lead to keeping a path
file (in /sys?) that I$open could look thru quickly when you type a
command that is not in the CMDS dir, it would then consult the list of
dir's in this "paths" file, until it did find the program you wanted to
run when you typed that name. That would neat too. And while it wouldn't
be a huge time saver, it sure would be faster that typing a long filename.
Winter ideas... ;-)
> Tuesday, December 9, 2014, 7:07:30 PM, you wrote:
> > I now understand what you want Kandur, It’s called shortcuts in
> > modern terms. You have an interesting idea here, could be feasible.
> >
> > Bill Nobel
> >
> >> On Dec 9, 2014, at 8:57 PM, Kandur <k at qdv.pw> wrote:
> >>
> >> Bill and Robert, thanks for the infos.
> >> Then let's forget about OS-9 scripts, all I want is to avoid
> >> typing in long path names of often used subdirs, when I want to
> >> chd into them. Perhaps a small utility with a menu like this?
> >> 1 dd/Coco/_Software/_OS-9/_OS-9_Utilities/Kwikgen
> >> 2 d1/Media_Players/WD_TV_Media_Player_-_New_for_2014/WD_TV_2014
> >> 3 d0/Coco/_Software/_CoCo_Controller_Software/LR-Tech/SUPER_BOARD
> >> Just enter the number to go to that directory.
> >>
> >> Kandur
> >>
> >> Tuesday, December 9, 2014, 5:20:14 PM, you wrote:
> >>> What you can do Kandur is whatever your CHD or CHX directory stuff
> >>> you put in the script will stay in the script. Scripts get thier
> >>> own shell for execution, it inherits the directory paths from the
> >>> calling shell (and device layout i.e. <>>>/wx). Until that shell
> >>> dies by you exiting the program in that script. Then all directory
> >>> paths revert to what you have in each shell you have running.
> >>>
> >>> Bill Nobel
> >>>
> >>>> On Dec 9, 2014, at 2:39 PM, Kandur <k at qdv.pw> wrote:
> >>>>
> >>>> Tuesday, December 9, 2014, 11:47:05 AM, Robert wrote:
> >>>>> Kandur wrote:
> >>>>>> I have another script question.
> >>>>>> What script would take me to a subdir?
> >>>>>> Instead typing every time: chd /dd/nitros9/6809L2/modules/RBF
> >>>>>> just to type: go2rbf
> >>>>>> I used build go2rbf with the above command line
> >>>>>> changed it's attribute to e pe, but it did not work.
> >>>>>> Kandur
> >>>>>
> >>>>> I may be wrong, but I don't think you can make a permanent change
> >>>>> of directories within a script. What you can do is change
> >>>>> directories, open a new window, and use the CLEAR key to switch
> >>>>> to that window.
> >>>>
> >>>> Don't mind at all to push the CLEAR key to go to a new window,
> >>>> as long as it's default directory is, e.g. /dd/NIRTOS9/8809L2
> >>>>
> >>>>> As an example, I can start Koronis Rift with the following
> >>>>> script. I must use the CLEAR key to get to the game window.
> >>>>>
> >>>>> xmode /w4 par=1 pag=10
> >>>>
> >>>> What are these parameters mean?
> >>>>
> >>>>> cd games/krift
> >>>>> (/dd/games/krift/cmds/autoex <>>>/w4)&
> >>>>>
> >>>>> A new window and shell start for the game.
> >>>>
> >>>> Sounds great.
> >>>> When you iniz or xmode a window, or starting a shell in it,
> >>>> is there a way to specify in which subdir should it start up?
> >>>>
> >>>>> Robert
> >>>>
> >>>> Kandur
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
More information about the Coco
mailing list