Add function replace_prefix_nullterm for use on mach-o rpaths. (#15347)
Add function replace_prefix_nullterm for use on mach-o rpaths. (#15347)

This recovers the old behavior of replace_prefix_bin that was
modified to work with elf binaries by prefixing os.sep to new prefix
until length is the same as old prefix.
LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack