The R Project SVN R

Rev

Rev 4010 | Blame | Last modification | View Log | Download | RSS feed

#!/bin/sh
#
# ${R_HOME}/bin/help

if [ "${1}" = "INDEX" ];
then
    subject=${2}
    shift 2
    for index in ${*}
    do
    if [ -f ${index} ];
    then
        file=`grep "^${subject} " ${index} | cut -f 2`
        if test -n "${file}"
        then
        echo `dirname ${index}`/${file}
        exit 0
        fi
    fi
    done    
    echo
elif [ "${1}" = "PRINT" ];
then
    LATEX=${4}
    if [ "${LATEX}" = "false" ];
    then
    echo "Cannot print, latex seems to be unavailable"
    exit 1
    fi
    DVIPS=${5}
    if [ "${DVIPS}" = "false" ];
    then
    echo "Cannot print, dvips seems to be unavailable"
    exit 2
    fi
    shift
    ODIR=`pwd`
    cd `dirname ${1}`
    ${LATEX} "\\nonstopmode\\input{${1}}" >/dev/null 2>&1
    ${DVIPS} ${1} 2>/dev/null
    if test -f ${1}.ps;
    then
        echo "Saving help page to \`${2}.ps'"
        mv ${1}.ps ${ODIR}/${2}.ps
    fi
    rm -f ${1}.aux ${1}.dvi ${1}.log
fi