Debian Codegraph @

lib/strdup.c

raw symbols SCIP
1 /* $Id: strdup.c,v 1.4 1999/03/10 07:57:53 boyns Exp $ */
2
3 /*
4 * Copyright (C) 1993-99 Mark R. Boyns <[email protected]>
5 *
6 * This file is part of rplay.
7 *
8 * rplay is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * rplay is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with rplay; see the file COPYING. If not, write to the
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24
25 #ifdef HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28 #include "strdup.h"
29 #include <stdio.h>
30
31 #ifndef HAVE_STRDUP
32 #ifdef __STDC__
33 char *
34 strdup(char *str)
35 #else
36 char *
37 strdup(str)
38 char *str;
39 #endif
40 {
41 char *p;
42
43 p = (char *) malloc(strlen(str) + 1);
44 if (p == NULL)
45 {
46 return NULL;
47 }
48 else
49 {
50 strcpy(p, str);
51 return p;
52 }
53 }
54 #endif /* HAVE_STRDUP */