The R Project SVN R

Rev

Rev 10641 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11358 hornik 1
#! /bin/sh
2
## Diff  ``without R version''
3
## usage: Rdiff from-file to-file exitstatus
4
## from-file equal to `-' means STDIN
5
 
6
ffile=${1}
7
tfile=${2}
8746 hornik 8
exitstatus=${3}
9
 
11358 hornik 10
## sed script to get rid of the startup message
11
script='/^R : Copyright/,/quit R.$/{d;}; p'
12
## egrep pattern to get rid of some more???
13
pattern='(^Number of.*:|^Time '
14
if test -n "`echo ${ffile} | grep primitive-funs`"; then
15
  pattern=${pattern}'|^\[1\] [19][0-9][0-9])'
8746 hornik 16
else
11358 hornik 17
  pattern=${pattern}')'
8746 hornik 18
fi
19
 
11358 hornik 20
tmpfile=${TMPDIR:-/tmp}/${ffile}-d.${$}
8746 hornik 21
 
11358 hornik 22
sed -e "${script}" ${ffile} | egrep -v "${pattern}" > ${tmpfile}
23
(sed -e "${script}" ${tfile} | \
24
  egrep -v "${pattern}" | \
25
  diff -bw ${tmpfile} - ) && exitstatus=0
26
 
8746 hornik 27
rm -f ${tmpfile}
11358 hornik 28
 
8746 hornik 29
exit ${exitstatus}