Back to index

tor  0.2.3.19-rc
Functions
strlcpy.c File Reference
#include <sys/types.h>
#include <string.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 42 of file strlcpy.c.

{
       register char *d = dst;
       register const char *s = src;
       register size_t n = siz;

       if (n == 0)
              return(strlen(s));
       while (*s != '\0') {
              if (n != 1) {
                     *d++ = *s;
                     n--;
              }
              s++;
       }
       *d = '\0';

       return(s - src);     /* count does not include NUL */
}