flag fields are u_int's
[unix-history] / usr / src / lib / libc / string / memccpy.c
CommitLineData
556da4c5
KB
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
317e5946
KB
3 * All rights reserved.
4 *
556da4c5 5 * %sccs.include.redist.c%
7bbdb8c5
RE
6 */
7
2ce81398 8#if defined(LIBC_SCCS) && !defined(lint)
a64329b4 9static char sccsid[] = "@(#)memccpy.c 5.7 (Berkeley) %G%";
317e5946 10#endif /* LIBC_SCCS and not lint */
7bbdb8c5 11
a64329b4 12#include <sys/cdefs.h>
556da4c5 13#include <string.h>
7bbdb8c5 14
556da4c5 15void *
7bbdb8c5 16memccpy(t, f, c, n)
25140ba2
KB
17 void *t;
18 const void *f;
19 int c;
556da4c5 20 register size_t n;
7bbdb8c5 21{
25140ba2
KB
22
23 if (n) {
24 register unsigned char *t;
25 register const unsigned char *f;
26 register unsigned char ch = c;
27
28 do {
29 if ((*t++ = *f++) == c)
30 return (t);
31 } while (--n != 0);
32 }
7bbdb8c5
RE
33 return (0);
34}