previous up next contents
Previous: q2bb_bounding_box Up: Batches génériques Next: qdd_diff_only   Contents

qbb_bounding_box


#! /bin/bash
# qbb_bounding_box

qui=$1 ; if ! test -f $qui ; then qui=$1.eps ; fi
shift

case $qui in 
	-h.eps)	echo ""
			echo "	syntax :" ;
			echo "	-y suivi de (g b d t) : absolues" ;
			echo "	+g -g etc : relatives" ;
  		echo "	-x : commit" ;
  		echo "" ;
			exit;;
esac

echo "   proceeding" $qui
zozo=`grep Bounding $qui | tail -n 1 | tr -d \\\r ` 
zozu=`echo $zozo`

z1=`echo "$zozo " | sed -e 's/\ .*//'`
zozo=`echo "$zozo" | sed -e 's/[^\ ]*\ //'`

zg=`echo "$zozo" | sed -e 's/\ .*//'`
zozo=`echo "$zozo" | sed -e 's/[^\ ]*\ //'`

zb=`echo "$zozo" | sed -e 's/\ .*//'`
zozo=`echo "$zozo" | sed -e 's/[^\ ]*\ //'`

zd=`echo "$zozo" | sed -e 's/\ .*//'`
zozo=`echo "$zozo" | sed -e 's/[^\ ]*\ //'`

# caveat : ctrl-j ctrl-m from the win world !!!
# echo $zg\xxx$zb\xxx$zd\xxx$zt\xxx$zozo\xxx 

# zozo=`echo "$zozo" | sed -e 's/[0-9]*/&\ xxx/'`
zt=`echo "$zozo" | sed -e 's/\ .*//'`

# echo $zg\aaa$zb\bbb$zd\ccc$zt\ddd

while test -n "$1" ; do

case $1 in
  		
  -y) zg=$2 ; zb=$3 ; zd=$4 ; zt=$5 ; shift ; shift ; shift ;;

 +g) zg=`echo $((zg-$2))` ;;
 -g) zg=`echo $((zg+$2))` ;;
 +b) zb=`echo $((zb-$2))` ;;
 -b) zb=`echo $((zb+$2))` ;;
 +d) zd=`echo $((zd+$2))` ;;
 -d) zd=`echo $((zd-$2))` ;;
 +t) zt=`echo $((zt+$2))` ;;
 -t) zt=`echo $((zt-$2))` ;;
 
 -x) xxx=commit    ;;
 *)  echo erreur   ;;
esac

shift ; shift
done

zozo=`echo "%%BoundingBox:" $zg $zb $zd $zt` 

echo was$zozu\xx ; echo now xx$zozo\xx 


sed -e "`echo  s/$zozu/$zozo/ `; //d " $qui > tmp.eps

if test -n "$xxx" ; then cp tmp.eps $qui ; else gv tmp.eps ;fi


previous up next contents
Previous: q2bb_bounding_box Up: Batches génériques Next: qdd_diff_only   Contents


douillet@ensait.fr
2003-06-24