💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › C › strdup… captured on 2023-06-14 at 18:41:26.

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Path: news.uiowa.edu!news.physics.uiowa.edu!math.ohio-state.edu!uwm.edu!lll-winken.llnl.gov!decwrl!tribune.usask.ca!rover.ucs.ualberta.ca!Myrias.AB.CA!eddore.myrias.com!eddore.myrias.com!not-for-mail
From: gdr@eddore.myrias.com (Devin Reade)
Newsgroups: comp.sys.apple2.gno
Subject: Re: Need help compiling udl
Date: 13 Apr 1996 22:59:18 -0600
Organization: Myrias Research Corporation
Lines: 28
Message-ID: <4kq0n6$3j4@eddore.myrias.com>
References: <Pine.SUN.3.91.960412052849.21133B-100000@subzero.winternet.com>
NNTP-Posting-Host: eddore.myrias.com

In article <Pine.SUN.3.91.960412052849.21133B-100000@subzero.winternet.com>,
Dragon King  <markhj01@winternet.com> 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?

Since Soenke's offline for a few weeks, I'll field this one ...
The easiest solution would be to include the source for strdup.
Place the following code in a file (like "strdup.c"), then compile
and link it in:

#include <stdlib.h>
#include <string.h>

char *
strdup(const char *s)
{
	char *p;

	if ((p = malloc(strlen(s)*sizeof(char))) != NULL) {
		strcpy(p,s);
	}
	return p;
}
-- 
	Devin Reade	gdr@eddore.myrias.ab.ca