Annotation of OpenXM_contrib/gnuplot/errorfix.sh, Revision 1.1.1.1
1.1 maekawa 1: #! /bin/sh
2: #
3: # $Id: errorfix.sh,v 1.4 1998/04/14 00:15:18 drd Exp $
4: #
5: # shell script to change #error and #warn cpp statements. This is necessary
6: # for the crippled non-ANSI compiler that HP ships with it's standard
7: # distribution, at least in <=9.0 for m68k
8: #
9: # this needs to be run once in gnuplot directory
10:
11: dir="$1" && test ${dir} || dir=.
12:
13: if [ "$dir" = . ] ; then
14: mkdirs=false
15: backup=true
16: else
17: mkdirs=true
18: backup=false
19: fi
20:
21: for i in `cd $dir && find . \( -name "*.c" -o -name "*.h" -o -name "*.trm" \) -print` ; do
22: grep "^#[ ]*[ew][ar]" ${dir}/${i} >/dev/null 2>&1
23: if [ $? -eq 0 ]; then
24: # found #error or #warning
25: sed -e 's%^#\([ ]*error\)%\1%' \
26: -e 's%^\(#[ ]*warning.*\)$%/* \1 */%' $dir/$i >.tmp
27: if $mkdirs ; then
28: dirnew=`echo $i | sed -n 's%^\./\([^/]*\)/.*$%\1%p'`
29: if [ x"$dirnew" != x ]; then
30: mkdir ${dirnew}
31: fi
32: fi
33: if $backup && [ ! -r $dir/$i.dist ]; then
34: mv $dir/$i $dir/$i.dist
35: fi
36: suffix=`echo $i | awk -F\. '{print $NF}'`
37: if [ $suffix = h ]; then
38: test -r $dir/$i && mv $dir/$i $dir/$i.dist
39: mv .tmp $dir/$i
40: else
41: mv .tmp $i
42: fi
43: echo fixed $i
44: fi
45: done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>