File: strdup.c

package info (click to toggle)
libbind 6.0-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 4,656 kB
  • ctags: 4,846
  • sloc: ansic: 39,507; sh: 8,415; makefile: 761
file content (20 lines) | stat: -rw-r--r-- 266 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "port_before.h"

#include <stdlib.h>

#include "port_after.h"

#ifndef NEED_STRDUP
int __bind_strdup_unneeded;
#else
char *
strdup(const char *src) {
	char *dst = malloc(strlen(src) + 1);

	if (dst)
		strcpy(dst, src);
	return (dst);
}
#endif

/*! \file */