[190] in Release_7.7_team
suggestion about "bin" and "add"
daemon@ATHENA.MIT.EDU (Gilbert Leung)
Thu Oct 20 16:38:36 1994
To: release-team@MIT.EDU
Date: Thu, 20 Oct 1994 16:36:24 -0400
From: Gilbert Leung <gleung@MIT.EDU>
For all afs lockers, Change all `machtype`bin to just "bin" which is a
symlink that points to, say, .bin.@sys.
Reasons for change:
1) As we get new machines, "decmips", "rsaix", "sun4", are not quite
sufficient. Machines from the same vendor might make different machine
types. And even for the same machine type, we might use different OS's.
Even with the same OS, we might have different major/minor versions.
".bin.@sys" solves the problem.
2) unclutters the directory. Users should see only "bin" instead of all 4
`machtype`bin (unless if you use -a or -A when you ls, or course)
3) much cleaner. You could "just 'cd bin'"
4) Way to improve the "add" alias. For example, you want to "add sipb".
the alias can check if "/mit/sipb/bin" exists in $PATH, otherwise append
it. Currently, it uses "$bindir", which is dirty.
Gilbert
----------- 8< ---------------- cut here ---------------- 8< -----------
Now I started it, I think "add" is very ugly... just look at $initdir/cshrc.
Would that take even the original programmer a while to understand everytime
he has to modify that alias?
A better way to do it is possibly :
alias add 'set argv = (\!*) && source $initdir/aliases/add add.src'
And then in the file $initdir/aliases/add, you could do whatever you want.
Several enhancements include:
1) multiple lockers on one "add" alias.
2) switch parsing. for
a) verbose mode
b) switches passable to "attach"
c) add path only with attaching
a common situation is that I know that locker
"foobar" is already attached. I just want to extend my PATH to include
/mit/outland/bin. I could now use say "add -p outland" to just add the
path)
An example of that would be (in the file $initdir/aliases/add) :
if ($#argv == 0) goto Usage
set attachswitches = ()
while ($#argv > 0 && "$1" =~ -*)
switch ($1)
case -v:
set addverbose
breaksw;
case -p:
set addpathonly
breaksw
default:
set attachswitches = ($attachswitches $1)
# append switches being passed to "attach"
breaksw
endsw
switch
end
foreach locker ($argv)
# use "attach" only of $addpathonly not set
if (! $?addpathonly) then
set dir = `attach $attachswitches -p $locker`
else
set dir = (`hesinfo $locker filsys`)
set dir = $dir[$#dir]
endif
if ("$PATH" !~ *$dir/bin*) setenv PATH ${PATH}:$dir/bin
if ("$MANPATH" !~ *$dir/bin*) setenv MANPATH ${PATH}:$dir/bin
end