strdup()
Ron Flax
ron at afsg.apple.com
Sun Jun 2 05:37:21 AEST 1991
In article <1991Jun1.071530.10961 at deadzone.uucp> marcelo at 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 at afsg.apple.com
Apple Federal Systems Group
More information about the Comp.unix.aux
mailing list