do_resolve 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. : '$Id$'
  2. : Resolve name clashes in the files on the argument list. If these
  3. : files reside in another directory, a copy is made in the current
  4. : directory. If not, it is overwritten. Never do this in a source
  5. : directory! A list of the new files is produced on standard output.
  6. UTIL_BIN=$UTIL_HOME/bin
  7. trap "rm -f tmp$$ a.out nmclash.* longnames clashes" 0 1 2 3 15
  8. : first find out if we have to resolve problems with identifier significance.
  9. cat > nmclash.c <<'EOF'
  10. /* Accepted if many characters of long names are significant */
  11. abcdefghijklmnopr() { }
  12. abcdefghijklmnopq() { }
  13. main() { }
  14. EOF
  15. if $CC nmclash.c
  16. then : no identifier significance problem
  17. for i in $*
  18. do
  19. echo $i
  20. done
  21. else
  22. $UTIL_BIN/prid -l7 $* > longnames
  23. : remove code generating routines from the clashes list.
  24. : code generating routine names start with C_.
  25. : also remove names starting with flt_.
  26. sed '/^C_/d' < longnames | sed '/^flt_/d' > tmp$$
  27. $UTIL_BIN/cclash -c -l7 tmp$$ > clashes
  28. for i in $*
  29. do
  30. $UTIL_BIN/cid -Fclashes < $i > tmp$$
  31. n=`basename $i .xxx`
  32. if cmp -s $n tmp$$
  33. then
  34. rm -f tmp$$
  35. else
  36. mv tmp$$ $n
  37. fi
  38. echo $n
  39. done
  40. fi