home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / irix / scripts / findu < prev    next >
Encoding:
Text File  |  1994-08-02  |  1.3 KB  |  55 lines

  1. #!/bin/csh -f
  2. #
  3. # This shell script outputs all procedures that are undefined in a
  4. # library.
  5. #
  6. # Synopsis:
  7. #    findu.csh lib1.a lib2.a ... > outfile
  8. #
  9.  
  10. if ( $#argv < 1 ) then
  11.     echo "Usage: $0 lib.a > outfile"
  12.     exit 0
  13. endif
  14.  
  15. set undefFile1 = /usr/var/tmp/tmp1$$
  16. set defFile1 = /usr/var/tmp/tmp2$$
  17. set nmOutputFile = /usr/var/tmp/tmp5$$
  18.  
  19. rm -f $undefFile1 $defFile1
  20.  
  21. foreach lib ( $argv )
  22.     nm $lib > $nmOutputFile
  23.     grep 'Proc' $nmOutputFile | grep 'Undefined' | \
  24.     awk '{print $NF,"Proc"}' >> $undefFile1
  25.     grep 'Global' $nmOutputFile | grep 'Undefined' | \
  26.     awk '{print $NF,"Global"}' >> $undefFile1
  27.     grep 'Proc' $nmOutputFile | grep -v 'Undefined' | \
  28.     awk '{print $NF,"Proc"}' >> $defFile1
  29.     grep 'Global' $nmOutputFile | grep -v 'Undefined' | \
  30.     awk '{print $NF,"Global"}' >> $defFile1
  31. end
  32.  
  33. rm $nmOutputFile
  34.  
  35. set undefFile2 = /usr/var/tmp/tmp3$$
  36. set defFile2 = /usr/var/tmp/tmp4$$
  37.  
  38. sort -u $undefFile1 > $undefFile2
  39. sort -u $defFile1 > $defFile2
  40.  
  41. set undefFile3 = /usr/var/tmp/tmp6$$
  42.  
  43. comm -23 $undefFile2 $defFile2 > $undefFile3
  44.  
  45. foreach undef ( `cat $undefFile3` )
  46.     grep ${undef}_ $defFile2 >& /dev/null
  47.     if ( $status == 0 ) then
  48.     echo "#define $undef ${undef}_" >> /usr/var/tmp/defines.h
  49.     endif
  50. end
  51.  
  52. cat $undefFile3
  53.  
  54. rm -f $undefFile1 $defFile1 $undefFile2 $defFile2 $undefFile3
  55.