The R Project SVN R

Rev

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

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