The R Project SVN R

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2160 hornik 1
#!/bin/sh
2
#
4580 hornik 3
# ${R_HOME}/bin/help
2160 hornik 4
 
5
if [ "${1}" = "INDEX" ];
6
then
7
    subject=${2}
8
    shift 2
3609 pd 9
    for index in ${*}
2160 hornik 10
    do
11
	if [ -f ${index} ];
12
	then
13
	    file=`grep "^${subject}	" ${index} | cut -f 2`
14
	    if test -n "${file}"
15
	    then
16
		echo `dirname ${index}`/${file}
17
		exit 0
18
	    fi
19
	fi
20
    done    
21
    echo
22
elif [ "${1}" = "PRINT" ];
23
then
3786 pd 24
    LATEX=${4}
2160 hornik 25
    if [ "${LATEX}" = "false" ];
26
    then
27
	echo "Cannot print, latex seems to be unavailable"
28
	exit 1
29
    fi
3786 pd 30
    DVIPS=${5}
2160 hornik 31
    if [ "${DVIPS}" = "false" ];
32
    then
33
	echo "Cannot print, dvips seems to be unavailable"
34
	exit 2
35
    fi
36
    shift
37
    ODIR=`pwd`
38
    cd `dirname ${1}`
3609 pd 39
    ${LATEX} "\\nonstopmode\\input{${1}}" >/dev/null 2>&1
2160 hornik 40
    ${DVIPS} ${1} 2>/dev/null
41
    if test -f ${1}.ps;
42
    then
3609 pd 43
        echo "Saving help page to \`${2}.ps'"
2160 hornik 44
        mv ${1}.ps ${ODIR}/${2}.ps
45
    fi
4010 ripley 46
    rm -f ${1}.aux ${1}.dvi ${1}.log
2160 hornik 47
fi