Clean up string2.h-related includes

- Remove unused split().
- Remove string2.h includes from files that were not using any function
  from there.
- Remove unnecessary system headers from string2.h, and add them to
  files where they are needed.  Some transitive dependencies can be
  left, since some headers actually require string.h etc.
- Add/remove ctype.h such that exactly those files that use functions
  from it actually include it.

There can be a few files now that use ctype.h without including
string2.h, which may trigger warnings on Cygwin, but those can be fixed
if we get around to properly supporting and testing Cygwin.

Preparation for moving string2.h from legacyheaders/.

Change-Id: Id9c441d2159ac3f06e088d6d7e0f05ffadb450cb