Define _XOPEN_SOURCE to get access to strdup() and strndup().