/* This file is in the public domain. */ #include #include #include "copyof.h" char *copyofstr(const char *str) { char *cp; if (str == 0) return(0); cp = malloc(strlen(str)+1); if (cp == 0) return(0); strcpy(cp,str); return(cp); } void *copyofblk(const void *blk, unsigned int len) { void *rv; if (blk == 0) return(0); rv = malloc(len); if (rv == 0) return(0); bcopy(blk,rv,len); return(rv); }