Hi, I compiled dillo-fltk2 on NetBSD-3.1, implementing strndup was the only change needed. However, strndup needs to null-terminate its return value, and strncpy does not do this if the source string is longer than the destination, so: * Johannes Hofmann:
* I added a own version of strndup() as it does not exist for DragonFly:
char* strndup(const char *s, size_t size) { char *r = (char*) calloc(size + 1, 1);
if (r) { strncpy(r, s, size);
r[size] = '\0'; /* null-terminate return value */
}
return r; }
Also, strndup is found in <string.h> only if _GNU_SOURCE was #define'd. This should probably be done in configure, with something like HAVE_STRNDUP, but I have no experience with autoconf. Regards, Alexander -- PGP key available