Implement strnlen locally if the system libc doesn't have it.

Needed for, and currently built only on, NetBSD 5.
Merge pull request #96 from riastradh/implement-strnlen

Implement strnlen locally if the system libc doesn't have it.