Obtained from: 386BSD-0.1 patchkit; also fixed in 1.1.5

Compare unsigned chars.
Return the place after where the character was found and not the start
of the string.
This commit is contained in:
Bruce Evans 1994-12-12 01:23:33 +00:00
parent a2c0622293
commit a0d0470f49
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5071

View File

@ -49,9 +49,10 @@ memccpy(t, f, c, n)
if (n) {
register unsigned char *tp = t;
register const unsigned char *fp = f;
register unsigned char uc = c;
do {
if ((*tp++ = *fp++) == c)
return (t);
if ((*tp++ = *fp++) == uc)
return (tp);
} while (--n != 0);
}
return (0);