#! /bin/sh
#
# Review the list of mods.
# At the moment, just look at the headers, using p_modinfo -h
#
# Future:
# * We could allow it to append to the modlist_exceptions file
#   when asked the interactive question
#

tmp=/tmp/$$
here=`pwd`
status=1
prog=`basename $0`
trap "rm -f $tmp.*; exit \$status" 0 1 2 15

_usage()
{
    cat << EOF
Usage: $prog workarea modlist

workarea  ptools workarea
modlist   modlist file
EOF
    exit 1
}


if [ $# -ne 2 ]
then
    _usage
    exit 1
fi

ism=$1
modlist=$2

if [ ! -d $ism ]
then
    echo "$prog: Unable to open $ism"
    exit 1
fi

cat $modlist |\
while read mod
do
    cd $ism
    export WORKAREA=`pwd`

    modlod=`echo $mod | cut -d':' -f1`
    modism=`echo $mod | cut -d':' -f2`
    modid=`echo $mod | cut -d':' -f3`
    rec=`echo $mod | cut -d':' -f4`
    mymod="$modlod:$modism:$modid"
    
    if [ $rec = "0" ]; then
	p_modinfo -h $mymod
    fi
done

status=0
