info-inventor
[Top] [All Lists]

Re: PPC: almost there, I think

To: Jeremy Buchmann <buchmann@xxxxxxxxxx>
Subject: Re: PPC: almost there, I think
From: "Scott S. Ross" <ssross@xxxxxxxxxx>
Date: Sun, 20 Aug 2000 15:39:49 -0600 (MDT)
Cc: info-inventor@xxxxxxxxxxx
In-reply-to: <200008202107.OAA15010@xxxxxxxxxxxxxxxx>
Reply-to: "Scott S. Ross" <ssross@xxxxxxxxxx>
Sender: owner-inventor@xxxxxxxxxxx
On Sun, 20 Aug 2000, Jeremy Buchmann wrote:

> First, thanks to Scott, Tom, and Jonathan for telling me where my compiler
> defines stuff :P
> 
> Second, I have now found that I get the error: 'strdup' undeclared...
> 
> I noticed some lines in the i386 section of machine.h that extern'd strdup()
> and bcopy(), so I copied those into my powerpc section, but I still got the
> errors...any ideas?
>
> Jeremy Buchmann
> buchmann@xxxxxxxxxx

On my machine, strdup is defined by a macro guarded by a bunch of #ifdef
tests.  Including <string.h> _should_ get you that macro. (the actual
macro is in string2.h).

If all else fails you can write your own strdup

char *
strdup(const char * s)
{
    size_t len = strlen(s)+1;
    char * retval = (char *)malloc(len);
    if (retval != NULL) memcpy(retval, s, len);
    return retval;
}

        later.
            scott


<Prev in Thread] Current Thread [Next in Thread>