/* xstrndup.c */ /* Copyright 1997 by Eberhard Mattes Donated to the public domain. No warranty. 1997-07-22 Initial version */ #include #include "firewall.h" #include "libemfw.h" /* Create a duplicate on the heap of the array of N characters pointed to by S. The duplicate will be null-terminated. Terminate the process on failure. */ char *xstrndup (const char *s, size_t len) { char *p = xmalloc (len + 1); memcpy (p, s, len); p[len] = 0; return p; }