142660Smarkm/* xstrdup.c -- copy a string with out of memory checking 2146515Sru Copyright (C) 1990, 1996, 1998, 2001, 2003 Free Software Foundation, Inc. 342660Smarkm 442660Smarkm This program is free software; you can redistribute it and/or modify 542660Smarkm it under the terms of the GNU General Public License as published by 642660Smarkm the Free Software Foundation; either version 2, or (at your option) 742660Smarkm any later version. 842660Smarkm 942660Smarkm This program is distributed in the hope that it will be useful, 1042660Smarkm but WITHOUT ANY WARRANTY; without even the implied warranty of 1142660Smarkm MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1242660Smarkm GNU General Public License for more details. 1342660Smarkm 1442660Smarkm You should have received a copy of the GNU General Public License 1542660Smarkm along with this program; if not, write to the Free Software Foundation, 1642660Smarkm Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 1742660Smarkm 1842660Smarkm#if HAVE_CONFIG_H 1942660Smarkm# include <config.h> 2042660Smarkm#endif 2142660Smarkm 22146515Sru/* Specification. */ 23146515Sru#include "xalloc.h" 2442660Smarkm 25146515Sru#include <string.h> 2642660Smarkm 2742660Smarkm/* Return a newly allocated copy of STRING. */ 2842660Smarkm 2942660Smarkmchar * 3093139Sruxstrdup (const char *string) 3142660Smarkm{ 3242660Smarkm return strcpy (xmalloc (strlen (string) + 1), string); 3342660Smarkm} 34