Back to index

opendkim  2.6.4
Functions | Variables
ar-strl.c File Reference
#include <sys/types.h>
#include <string.h>

Go to the source code of this file.

Functions

size_t ar_strlcpy (char *dst, const char *src, ssize_t size)
size_t ar_strlcat (char *dst, const char *src, ssize_t size)

Variables

static char ar_strl_c_id [] = "@(#)$Id: ar-strl.c,v 1.2 2009/08/03 18:22:04 cm-msk Exp $"

Function Documentation

size_t ar_strlcat ( char *  dst,
const char *  src,
ssize_t  size 
)

Definition at line 106 of file ar-strl.c.

{
       register ssize_t i, j, o;

       o = strlen(dst);
       if (size < o + 1)
              return o + strlen(src);
       size -= o + 1;
       for (i = 0, j = o; i < size && (dst[j] = src[i]) != 0; i++, j++)
              continue;
       dst[j] = '\0';
       if (src[i] == '\0')
              return j;
       else
              return j + strlen(src + i);
}
size_t ar_strlcpy ( char *  dst,
const char *  src,
ssize_t  size 
)

Definition at line 58 of file ar-strl.c.

{
       register ssize_t i;

       if (size-- <= 0)
              return strlen(src);
       for (i = 0; i < size && (dst[i] = src[i]) != 0; i++)
              continue;
       dst[i] = '\0';
       if (src[i] == '\0')
              return i;
       else
              return i + strlen(src + i);
}

Variable Documentation

char ar_strl_c_id[] = "@(#)$Id: ar-strl.c,v 1.2 2009/08/03 18:22:04 cm-msk Exp $" [static]

Definition at line 13 of file ar-strl.c.