#!/bin/sh
# Aplica a todas las fuentes PHP las transformaciones
# de herram/trans.awk y herram/trans.sed
# Dominio público. 2009. vtamara@pasosdeJesus.org

mkdir -p /tmp/pruebas/aut
mkdir -p /tmp/aut
mkdir -p /tmp/herram

sn="";
for i in `find . -name "*php"`; do
	echo "Transformando $i";
	awk -f herram/trans.awk $i | sed -f herram/trans.sed > /tmp/$i
	diff $i /tmp/$i;
	if (test "$?" = "1") then {
		echo -n "Remplazar (s/n)? ";
		if (test "$sn" != "S") then {
			read sn
		} fi;
		if (test "$sn" = "s" -o "$sn" = "S") then {
			cp /tmp/$i $i;
		} fi;
	} fi;
done
