PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
strlcat.c File Reference
#include "c.h"
Include dependency graph for strlcat.c:

Go to the source code of this file.

Functions

size_t strlcat (char *dst, const char *src, size_t siz)
 

Function Documentation

◆ strlcat()

size_t strlcat ( char *  dst,
const char *  src,
size_t  siz 
)

Definition at line 33 of file strlcat.c.

34{
35 char *d = dst;
36 const char *s = src;
37 size_t n = siz;
38 size_t dlen;
39
40 /* Find the end of dst and adjust bytes left but don't go past end */
41 while (n-- != 0 && *d != '\0')
42 d++;
43 dlen = d - dst;
44 n = siz - dlen;
45
46 if (n == 0)
47 return (dlen + strlen(s));
48 while (*s != '\0')
49 {
50 if (n != 1)
51 {
52 *d++ = *s;
53 n--;
54 }
55 s++;
56 }
57 *d = '\0';
58
59 return (dlen + (s - src)); /* count does not include NUL */
60}

Referenced by _PrepParallelRestore(), CreateBackupStreamer(), CreateLockFile(), get_configdata(), get_prompt(), and pqsecure_raw_write().