RedMine 6397: rewrite SplitProcLine and clean up in its file

Long over-due clean-up and reworking.
See commit comments for explanations of the various parts of the whole.

[The "RedMine 6397 mitigation" commit originally here has been taken in separately to fix urgent Solaris's problems.]