File: strdup.c

package info (click to toggle)
trueprint 5.3-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, squeeze, wheezy
  • size: 1,744 kB
  • ctags: 728
  • sloc: ansic: 8,296; sh: 1,225; makefile: 138
file content (16 lines) | stat: -rw-r--r-- 338 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/***************************************************************************
 * STRDUP
 * - uses malloc() to grab memory and fills it with a copy of a string.
 */

#include "src/utils.h"

char *strdup(const char *from_string)
{
  char *retval;

  retval = xmalloc(strlen(from_string)+1);

  strcpy(retval,from_string);
  return retval;
}