Xref: utzoo unix-pc.general:3140 comp.lang.c:19512 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!apple!vsi1!wyse!mips!prls!philabs!phri!marob!daveh From: daveh@marob.masa.com (Dave Hammond) Newsgroups: unix-pc.general,comp.lang.c Subject: Re: strdup() "need source" Keywords: big.banner Message-ID: <1989Jun16.115742.5630@marob.masa.com> Date: 16 Jun 89 11:57:42 GMT References: <124@sssphx.UUCP> Reply-To: daveh@marob.masa.com (Dave Hammond) Distribution: usa Organization: ESCC New York City Lines: 28 Sorry, folks. I tried to `R'eply to this, but something called /usr/lib/news/recmail appears missing (I don't administer news here, I just read it). To: rl@sssphx.UUCP Subject: Re: strdup() "need source" In article <124@sssphx.UUCP> you write: >I need the function strdup() if someone would be so kind to send [...] Hmm, off the top of my head: /* return a malloc'd copy of STRING or Null for errors */ char * strdup(string) char *string; { char *malloc(), *strcpy(); char *area = (char *)0; int n; if (string && (area = malloc(strlen(string)+1)) (void) strcpy(area, string); return(area); } -- Dave Hammond daveh@marob.masa.com