view dcclib/strlcat.c @ 4:d329bb5c36d0

Changes making it compile the new upstream release
author Peter Gervai <grin@grin.hu>
date Tue, 10 Mar 2009 14:57:12 +0100
parents c7f6b056b673
children
line wrap: on
line source

/* compatibility hack */

#include "dcc_defs.h"

int
dcc_strlcat(char *dst, const char *src, int lim)
{
	int dlen, slen, delta;

	dlen = strlen(dst);
	delta = lim - dlen;
	if (delta <= 0)
		return lim;

	slen = strlen(src);
	if (slen >= delta)
		slen = delta-1;
	if (slen <= 0)
		return dlen;
	memcpy(dst+dlen, src, slen);
	dlen += slen;
	dst[dlen] = '\0';
	return dlen;
}