#!/bin/bash # --------------------------------------------------------------------------- # # find_switch : Find compiler switches in subroutines and include files. # # # # use : find_switch [switch] # # switch : any strig for which the code is to be scanned. # # # # Hendrik L. Tolman # # May 2009 # # # # Copyright 2009 National Weather Service (NWS), # # National Oceanic and Atmospheric Administration. All rights # # reserved. WAVEWATCH III is a trademark of the NWS. # # No unauthorized use without permission. # # # # --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- # # 1. Preparations # # --------------------------------------------------------------------------- # # 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' echo 'Find switches in WAVEWATCH III' echo '------------------------------' # 1.b Process/save input - - - - - - - - - - - - - - - - - - - - - - - - - - - if test "$#" != '0' then switch="$1" else echo -n "Switch ? : " ; read switch progs="$*" fi echo ' ' ; echo "Files including $switch :" ; echo ' ' # 1.c Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv main_dir=$WWATCH3_DIR temp_dir=$WWATCH3_TMP source=$WWATCH3_SOURCE list=$WWATCH3_LIST # 1.d Raw data file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cd $main_dir/ftn grep "$switch" * | sed 's/\:/ /' | awk '{ print $1}' > ../.switch.files # 1.e Output - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - last=$NULL for file in `cat ../.switch.files` do if test "$file" != "$last" then echo " $file" last="$file" fi done rm -f ../.switch.files echo ' ' # End of find_switch -------------------------------------------------------- #