Re: strdup Must Die!

Albert Fluegel (albert.fluegel@hl.siemens.de)
Tue, 09 Mar 1999 13:36:52 +0100


John Brewer wrote:
> strdup must die ????????

On what f..... platform is no strdup available ?
If it's indeed that way, how about

char *
strdup(char * str)
{
char *newstring;

newstring = (char *) malloc(sizeof(char) * (strlen(str) + 1));
if(!newstring)
return(NULL);

strcpy(newstring, str);

return(newstring);
}

Or must strcpy and strlen also die ?
I guess i'm not the only one, who have an idea how to implement it.

AF

>
> Error : undefined identifier 'strdup'
> ie_exp_HTML.cpp line 317 XML_Char* p = strdup(pszDecor);
>
> Error : undefined identifier 'strdup'
> ie_exp_HTML.cpp line 340 XML_Char* p = strdup(pszDecor);
>
> Error : undefined identifier 'strdup'
> ie_exp_HTML.cpp line 431 XML_Char* p = strdup(pszDecor);
>
> Error : undefined identifier 'strdup'
> ie_exp_HTML.cpp line 454 XML_Char* p = strdup(pszDecor);
>
> Error : undefined identifier 'strdup'
> fp_TextRun.cpp line 88 XML_Char* p = strdup(pszDecor);
>
> John Brewer
> Jera Design
>
> Double-click anywhere with JarRunner! http://www.jera.com/jarrunner/

-- 
Albert Flügel, tdsc        Tel.:   +49-89-636-27690
bei: Siemens AG            Fax.:   +49-89-636-28983
Balanstr. 73               D1:     +49-171-3698673
81541 München              mailto: Albert.Fluegel@hl.siemens.de


This archive was generated by hypermail 1.03b2.