#
# shows:    Show all currently defined scratchpad directories, in reverse
#           chronological order (by definition date).
# Written by Leor Zolman, 10/92
# Uses PROJDIR variable defined and exported by login startup script.
#

dirlist=`ls -t $PROJDIR/*dir 2>&1`
if [ $? -ne 0 ]; then
    echo "There are no scratchpad directories defined."
    return
fi

newest=`echo "$dirlist" | head -1`
ls $PROJDIR/*dir | 
    awk '{
        pos = length($1)
        while (substr($1, pos-1, 1) != "/")
            pos--;
        c = substr($1, pos, length($1) - pos - 2)
        printf "echo \"%s Scratchpad directory %s = `cat %s` \"\n",
            (($1 == newest) ? " -->" : "    "), c, $1
    }' newest="$newest" |  sh
