Removed usage of strchrnul() which is not available on OS X