#!/bin/sh -f

if [ "$1" = "-undo" ]; then
  shift
  for f in $*; do
    echo -n "Restoring $f ..."
    p=`basename $f .bak`
    mv $f $p
    echo "ok"
  done
  exit
fi

for f in $*; do
   echo -n "Processing $f ..."
   cp -p $f $f.bak
   sed --regexp-extended -e 's/^%(\s+\w+\(.*\))/%%\1/' $f.bak > $f
   echo "ok"
done
