Use str_copy instead of strdup

Since strdup is not standardized in ANSI C, use str_copy instead.