#! /bin/tcsh -f 
# 
# readlink: Replacement for readlink(1), which Mac OS X 10.3.9 apparently doesn't provide.  J. E. Brown  http://users.aol.com/SolarAlmanac  Sun 083108 
# 
# Warning: 
#   This is not a full implementation of readlink! 
#   This script takes no command-line options 
#   and has just enough functionality to get Octave running. 
# 
# Usage: 
#   readlink link-or-filename 
# 
# References: 
#   1. readlink man page, http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/readlink.1.html 
#   2. Octave fails to run on Mac OS 10.3.9, http://www.nabble.com/Octave.app-3.0.1-for-Mac-OS-X-td16912388.html#a19094743 

if ( -l $1 ) then 
    # It's a symbolic link. Find out what it points to: 
    /bin/ls -l $1 | sed -e ' s/^.*-> //' 
else 
    echo ""
    exit 1
    endif