about summary refs log tree commit diff
path: root/stecpy-memccpy.c
blob: e4ce25925bb890e42934dba3a7f732b43a2818eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <string.h>

char *
stecpy(char *dst, char *end, const char *src)
{
        if (dst >= end)
                return dst;

	dst = memccpy(dst, src, '\0', end - dst);
	if (!dst) {
		end[-1] = 0;
		return end;
	}

	return dst - 1;
}