Path: news.uiowa.edu!news.physics.uiowa.edu!math.ohio-state.edu!usc!howland.reston.ans.net!gatech!swrinde!newsfeed.internetmci.com!in2.uu.net!comp.vuw.ac.nz!asgard.actrix.gen.nz!atlantis.actrix.gen.nz!not-for-mail From: dempson@atlantis.actrix.gen.nz (David Empson) Newsgroups: comp.sys.apple2.gno Subject: Re: Need help compiling udl Date: 16 Apr 1996 00:13:09 +1200 Organization: Actrix - Internet Services Lines: 21 Message-ID: <4ktegl$43a@atlantis.atlantis.actrix.gen.nz> References: NNTP-Posting-Host: atlantis.actrix.gen.nz In article , Dragon King wrote: > It seems that the sys admins for my school account have an old string > library. > I was trying to compile udl v1.14 and all went fine until it tried to > link everything. strdup could not be resolved. Is there a way to modify > the code to get around this? Just write your own implementation of strdup: char *strdup(const char *s) { char *s_copy; s_copy = malloc(strlen(s) + 1); if (s_copy) strcpy(s_copy, s); return s_copy; } -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand Path: news.uiowa.edu!news.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!gatech!newsfeed.internetmci.com!in2.uu.net!comp.vuw.ac.nz!asgard.actrix.gen.nz!atlantis.actrix.gen.nz!not-for-mail From: dempson@atlantis.actrix.gen.nz (David Empson) Newsgroups: comp.sys.apple2.gno Subject: Re: Need help compiling udl Date: 16 Apr 1996 00:14:33 +1200 Organization: Actrix - Internet Services Lines: 24 Message-ID: <4ktej9$45k@atlantis.atlantis.actrix.gen.nz> References: <4ktegl$43a@atlantis.atlantis.actrix.gen.nz> NNTP-Posting-Host: atlantis.actrix.gen.nz In article <4ktegl$43a@atlantis.atlantis.actrix.gen.nz>, David Empson wrote: > > Just write your own implementation of strdup: > > char *strdup(const char *s) { > char *s_copy; > s_copy = malloc(strlen(s) + 1); > if (s_copy) > strcpy(s_copy, s); > return s_copy; > } Come to think of it: add this line before the malloc: if (!s) return s; We don't want to copy rubbish from a NULL pointer, after all... -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand