File: errorfix.sh

package info (click to toggle)
gnuplot 3.5beta6.340-5
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 4,792 kB
  • ctags: 4,205
  • sloc: ansic: 41,878; asm: 539; makefile: 498; objc: 379; csh: 297; sh: 277; pascal: 194; perl: 138; lisp: 88
file content (51 lines) | stat: -rwxr-xr-x 942 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /bin/sh
#
# $Id: errorfix.sh,v 1.3 1997/03/09 23:49:49 drd Exp $
#
# shell script to change #error and #warn cpp statements. This is necessary
# for the crippled non-ANSI compiler that HP ships with it's standard
# distribution, at least in <=9.0 for m68k
#
# this needs to be run once in gnuplot directory

if [ $# = 0 ]
then
  dir=.
else
  dir=$1
fi

if [ $dir = . ]
then
  mkdirs=false
  backup=true
else
  mkdirs=true
  backup=false
fi

for i in `cd $dir;find . \( -name "*.c" -o -name "*.h" -o -name "*.trm" \) -print`
do
  sed -e 's/^#\([ 	]*error\)/\1/' \
      -e 's@^\(#[ 	]*warning.*\)$@/* \1 */@' $dir/$i >.tmp
  if cmp -s $dir/$i .tmp
  then
    rm .tmp
  else
    if $mkdirs
    then
      mkdirs `echo $i|sed 's@/[^/]*$@@'`
    fi
    if $backup && [ ! -r $dir/$i.dist ]
    then
      mv $dir/$i $dir/$i.dist
    fi
    if cmp -s .tmp $i
    then
      rm .tmp
    else
      mv .tmp $i
      echo fixed $i
    fi
  fi
done