Handle missing strdup in linux.
Support linux as well as OS X, use strdup where it makes more sense to do so.