This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Re: jartool.c:539: undefined reference to `strdup'


> 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;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]