Penguin
Annotated edit history of strdup(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 STRDUP
2 !!!STRDUP
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 ERRORS
8 CONFORMING TO
9 SEE ALSO
10 ----
11 !!NAME
12
13
14 strdup, strndup - duplicate a string
15 !!SYNOPSIS
16
17
18 __#include
19 __''s''__);
20 char *strndup(const char *__''s''__, size_t__ ''size''__);
21 __
22 !!DESCRIPTION
23
24
25 The __strdup()__ function returns a pointer to a new
26 string which is a duplicate of the string ''s''. Memory
27 for the new string is obtained with malloc(3), and
28 can be freed with free(3).
29
30
31 The __strndup()__ works like __strdup()__ but it only
32 copies the first ''size'' bytes. It always add a NUL
33 terminator, unlike strncpy(3).
34 !!RETURN VALUE
35
36
37 These functions returns a pointer to the duplicated string,
38 or NULL if insufficient memory was available.
39 !!ERRORS
40
41
42 __ENOMEM__
43
44
45 Insufficient memory available to allocate duplicate
46 string.
47 !!CONFORMING TO
48
49
50 SVID 3, BSD 4.3
51
52
53 __strndup()__ is a GNU extension.
54 !!SEE ALSO
55
56
57 calloc(3), malloc(3), realloc(3),
58 free(3)
59 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.