home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / libiberty / xstrdup.c < prev    next >
C/C++ Source or Header  |  1996-09-28  |  338b  |  18 lines

  1. /* xstrdup.c -- Duplicate a string in memory, using xmalloc.
  2.    This trivial function is in the public domain.
  3.    Ian Lance Taylor, Cygnus Support, December 1995.  */
  4.  
  5. #include "ansidecl.h"
  6. #include "libiberty.h"
  7.  
  8. char *
  9. xstrdup (s)
  10.      const char *s;
  11. {
  12.   char *ret;
  13.  
  14.   ret = xmalloc (strlen (s) + 1);
  15.   strcpy (ret, s);
  16.   return ret;
  17. }
  18.