This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
PATCH: Re: jartool.c:539: undefined reference to `strdup'
- To: dave at hiauly1 dot hia dot nrc dot ca (John David Anglin)
- Subject: PATCH: Re: jartool.c:539: undefined reference to `strdup'
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Thu, 3 May 2001 12:57:13 -0400 (EDT)
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
> 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 <dave@hiauly1.hia.nrc.ca>
* 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;
}