Article Listing 1 Listing 2 Listing 3 Listing 4
Listing 5 apr97.tar

Listing 3: Example for processing words

GetBaseName()   # target full-path
{
if Matches "$2" '*/'
then
eval $1=.
else
SplitSep pathparts "/" $2
GetLastWord $1 $pathparts
fi
}

GetDirName()    # target full-path
{
case "$2" in
/*/*)
SplitSep pathparts "/" $2
GetAllButLastWord $1 "/" "" $pathparts
;;
/*)
eval $1='/'
;;
*/*)
SplitSep pathparts "/" $2
GetAllButLastWord $1 "/" $pathparts
;;
*)
eval $1=.
;;
esac
}

# End of File