Return to BSD News archive
Xref: sserve comp.unix.bsd:5896 comp.sys.ibm.pc.rt:1680 comp.unix.large:611 Path: sserve!manuel!munnari.oz.au!uunet!haven.umd.edu!darwin.sura.net!jvnc.net!yale.edu!spool.mu.edu!olivea!sgigate!odin!mips!koblas From: koblas@mips.com (David Koblas) Newsgroups: comp.unix.bsd,comp.sys.ibm.pc.rt,comp.unix.large Subject: Re: strdup Message-ID: <lckirmINNosg@spim.mti.sgi.com> Date: 1 Oct 92 00:51:02 GMT References: <br.pct.52.717898310@RLG.Stanford.EDU> Organization: MIPS Computer Systems, Sunnyvale, California Lines: 19 NNTP-Posting-Host: ecstasy.mti.sgi.com In article <br.pct.52.717898310@RLG.Stanford.EDU> br.pct@RLG.Stanford.EDU (Peter C. Tam) writes: > > In BSD 4.3 C lib, there is no strdup that is provided in System 5, >& I just happened to get a program that was supposed to be able to compile >in BSD also. Can anyone tell me where I can get the strdup routine for >BSD 4.3, especially, in ibm.pc.rt AOS. Here's a copy (typed in off the cuff, so I won't say it is guaranteed to work): char *strdup(char *str) { char *cp = (char *)malloc(strlen(str)); return cp ? strcpy(cp, str), cp : NULL; } -- name : David Koblas domain: koblas@mips.com quote: If you have sex in your car, does that make it a recreational vehicle?