Copy memmem, strdup, and strndup from libiberty rather than writing our own (or copying from some other source)

Remove _BSD_SOURCE define