#!/bin/sh
 
#    Dec 06/04 - F.Majaess

#id  dfxdiag  - Changes "oldiag=..." occurences in a subdirectory to "oldiag=diag4".

#    AUTHOR  - F. Majaess

#hd  PURPOSE - "dfxdiag" script is used to change any "oldiag" settings, in each 
#hd            file contained within the trageted subdirectory, to target "diag4" 
#hd            library.
#hd            Note: It calls "ffxdiag" script for each targeted file ("aid ffxdiag"
#hd                  for more details).
#hd                  The list must consist of just subdirectory reference(s).
#hd

#pr  PARAMETERS:
#pr 
#pr    POSITIONAL
#pr 
#pr   dir1 dir2 ... dirm = list of m subdirectories with files contained within 
#pr                        that require fixing.

#ex  EXAMPLE
#ex  
#ex   dfxdiag $HOME/jobs
#ex  
#ex   The above example changes "oldiag" setting (if present) in
#ex   in each file contained within $HOME/jobs subdirectory to target 
#ex   "diag4".

# set -x
LOGNAME=${LOGNAME:-`logname`}


#  * Loop over all files in the input list.

for Dir
do
 if [ ! -d ${Dir} ] ; then
  echo "dfxdiag - skipped processing invalid ${Dir} subdirectory!"
 else
  echo "dfxdiag - processing directory $Dir"
  find ${Dir} -depth -exec ffxdiag {} \;
 fi
done
exit
