The R Project SVN R

Rev

Rev 11550 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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