Rewrite which procedure to implement heuristics

Previously, which could never work correctly with a file name containing
directories with white space in their names.  These heuristics provide an
alternate list of candidates to check if not performing a path search.
4 files changed