lookup executable in search path
prepend cwd unless test string is an absolute path
generalize to any search string.

Also includes memory usage improvements.
reduce variable scope
d_namlen is Darwin specific
Add path_lookup for e.g. $PATH exe lookups.

* pull-316:
  d_namlen is Darwin specific
  reduce variable scope
  generalize to any search string.
  prepend cwd unless test string is an absolute path
  lookup executable in search path
printf CCTOOLS_VERSION_MICRO in '%s', not in '%d'

The printf type of CCTOOLS_VERSION_MICRO should be string type('%s').
However, ftsh.c treated it as an int variable('%d').