1840175f0Skstailey /* xstrdup.c -- copy a string with out of memory checking
2*a1acfa9bSespie Copyright (C) 1990, 1996, 1998, 2001, 2003 Free Software Foundation, Inc.
3840175f0Skstailey
4840175f0Skstailey This program is free software; you can redistribute it and/or modify
5840175f0Skstailey it under the terms of the GNU General Public License as published by
6840175f0Skstailey the Free Software Foundation; either version 2, or (at your option)
7840175f0Skstailey any later version.
8840175f0Skstailey
9840175f0Skstailey This program is distributed in the hope that it will be useful,
10840175f0Skstailey but WITHOUT ANY WARRANTY; without even the implied warranty of
11840175f0Skstailey MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12840175f0Skstailey GNU General Public License for more details.
13840175f0Skstailey
14840175f0Skstailey You should have received a copy of the GNU General Public License
15840175f0Skstailey along with this program; if not, write to the Free Software Foundation,
16840175f0Skstailey Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17840175f0Skstailey
18840175f0Skstailey #if HAVE_CONFIG_H
19840175f0Skstailey # include <config.h>
20840175f0Skstailey #endif
21840175f0Skstailey
22*a1acfa9bSespie /* Specification. */
23*a1acfa9bSespie #include "xalloc.h"
243fb98d4aSespie
25840175f0Skstailey #include <string.h>
26840175f0Skstailey
27840175f0Skstailey /* Return a newly allocated copy of STRING. */
28840175f0Skstailey
29840175f0Skstailey char *
xstrdup(const char * string)303fb98d4aSespie xstrdup (const char *string)
31840175f0Skstailey {
32840175f0Skstailey return strcpy (xmalloc (strlen (string) + 1), string);
33840175f0Skstailey }
34