about summary refs log tree commit diff
path: root/steccpy.c
blob: 3bf8da1d4741229371649ec4326c8d570918120f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
char *
steccpy(char *dst, char *end, const char *src, int c)
{
	if (dst >= end)
		return dst;

	while (dst < end && *src != c && (*dst = *src))
		src++, dst++;

	if (dst == end)
		dst[-1] = 0;
	else if (*src == c)
		dst[0] = 0;

	return dst;
}