Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!mips!apple!afsg!ron From: ron@afsg.apple.com (Ron Flax) Newsgroups: comp.unix.aux Subject: Re: strdup() Message-ID: <576@afsg.apple.com> Date: 1 Jun 91 19:37:21 GMT References: <1991Jun1.071530.10961@deadzone.uucp> Organization: Apple Federal Systems Group Lines: 32 In article <1991Jun1.071530.10961@deadzone.uucp> marcelo@deadzone.uucp (Marcelo Gallardo) writes: > Well I've figured out that A/UX doesn't have strdup (at least I > can't find it). Is there anything that I can do? I guess it's > obvious by now that my knowledge of C is limited. Try this... #ifdef STRDUP_MISSING char *malloc (); char *strcpy (); /* Return a newly allocated copy of string S; return 0 if out of memory. */ char * strdup (s) char *s; { char *p; p = malloc ((unsigned) (strlen (s) + 1)); if (p) strcpy (p, s); return p; } #endif -- Ron Flax ron@afsg.apple.com Apple Federal Systems Group