#!/bin/sh 

# format,
#   runall clean
#   runall setup
#   runall run

progname=$(basename $0)

if [ $# -eq 0 ]; then
    echo "Usage: $progname (clean|setup|run)" >&2;
    exit 1
fi

ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
export ABAC_PROVER_PATH

for i in `ls -1 `; do
   if ( file $i | grep -Fq directory ); then
       cd $i;
       if [ "$1" = "clean" ]; then
           rm -rf ../allout.sha ../allout.cn
           printf "\n ==> CLEANING on %s\n" "$i" >& 2 ;
           rm -rf *.der *.pem creds_dump
       elif [ "$1" = "setup" ]; then
           printf "\n ==> SETUP on %s\n" "$i"  >& 2;
           ./README
       elif [ "$1" = "run" ] ; then
           printf "\n ==> RUN on %s\n" "$i" ;
           ./run_query 
       fi 
       cd ..;
   fi
done
