The R Project SVN R

Rev

Rev 11741 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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