aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/xpm/strdup.c
blob: 2611949c77e186d59116fecc8a376f69f34a6683 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>

/*
 * STRDUP -- Return a pointer to a copy of the input string.
 */
char *
strdup (s)
char	*s;
{
	char *str;
	int nchars;
	char *malloc();

	nchars = strlen(s) + 1;
	if ((str = malloc (nchars)) == NULL)
	    return (NULL);
	memmove (str, s, nchars);
	return (str);
}