I don't know how portable libstdc++ is supposed to be, but strtok_r is a latter addition (though you can probably always find it where you find pthreads). strdup is nonstandard but has been in most systems for a decade.