The R Project SVN R

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
11358 hornik 1
#! /bin/sh
11515 hornik 2
##
22506 hornik 3
## Rdiff -- Diff 'without R version'
11358 hornik 4
 
22506 hornik 5
## Usage:
6
##   R CMD Rdiff from-file to-file exitstatus
7
## where from-file equal to '-' means STDIN
8
 
11358 hornik 9
ffile=${1}
10
tfile=${2}
8746 hornik 11
exitstatus=${3}
12
 
11358 hornik 13
## sed script to get rid of the startup message
11384 hornik 14
script='/^R : Copyright/,/quit R.$/{d;}'
11358 hornik 15
## egrep pattern to get rid of some more???
11741 hornik 16
pattern='(^Number of.*:|^Time |^Loading required package.*'
22506 hornik 17
case "${ffile}" in
18
  *primitive-funs*)
19
    pattern=${pattern}'|^\[1\] [19][0-9][0-9])'
20
    ;;
21
  *)
23041 ripley 22
    pattern=${pattern}'|^<environment)'
22506 hornik 23
    ;;
24
esac  
8746 hornik 25
 
11550 hornik 26
tmpfile=${TMPDIR-/tmp}/${ffile}-d.${$}
8746 hornik 27
 
11476 maechler 28
if test ${ffile} = '-' ; then 
29
  ffile=''
30
fi
31
 
22506 hornik 32
sed -e "${script}" ${ffile} | ${EGREP} -v "${pattern}" > ${tmpfile}
11358 hornik 33
(sed -e "${script}" ${tfile} | \
22506 hornik 34
  ${EGREP} -v "${pattern}" | \
11358 hornik 35
  diff -bw ${tmpfile} - ) && exitstatus=0
36
 
8746 hornik 37
rm -f ${tmpfile}
11358 hornik 38
 
8746 hornik 39
exit ${exitstatus}