The R Project SVN R

Rev

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

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