home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March / PCWK3A99.iso / Linux / DDD331 / DDD-3_1_.000 / DDD-3_1_ / ddd-3.1.1 / libiberty / xstrdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-11  |  338 b   |  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.