From mboxrd@z Thu Jan 1 00:00:00 1970 From: "John David Anglin" To: dave@hiauly1.hia.nrc.ca (John David Anglin) Cc: gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: PATCH: Re: jartool.c:539: undefined reference to `strdup' Date: Thu, 03 May 2001 09:57:00 -0000 Message-id: <200105031657.MAA03729@hiauly1.hia.nrc.ca> References: X-SW-Source: 2001-05/msg00174.html > It can be worked around by linking with libiberty.a or adding a version of > strdup to jartool.c. OK for branch and main? Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605) 2001-05-03 John David Anglin * jartool.c (strdup): New function. --- jartool.c.orig Thu Dec 28 16:47:37 2000 +++ jartool.c Thu May 3 12:26:57 2001 @@ -223,6 +223,7 @@ int make_manifest(int, const char*); static void init_args(char **, int); static char *get_next_arg (void); +static char *strdup (char*); /* global variables */ ub1 file_header[30]; @@ -1825,4 +1826,15 @@ "); exit(1); +} + +static char * +strdup(s) + char *s; +{ + char *result = (char*)malloc(strlen(s) + 1); + if (result == (char*)0) + return (char*)0; + strcpy(result, s); + return result; }