Last change
on this file since 0292fbb was 5c13d64, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Use void pointers for mem*() functions.
|
-
Property mode
set to
100644
|
File size:
609 bytes
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | memccpy.c -- copy bytes until character seen
|
---|
4 | Version 1 -- 1987-06-12
|
---|
5 |
|
---|
6 | Copy vp2 to vp1, stopping if character c is copied.
|
---|
7 | Copy no more than n bytes.
|
---|
8 | Return a pointer to the byte after character c in the copy,
|
---|
9 | or NULL if c is not found in the first n bytes.
|
---|
10 | =============================================================================
|
---|
11 | */
|
---|
12 |
|
---|
13 | void *memccpy(void *vp1, void *vp2, char c, int n)
|
---|
14 | {
|
---|
15 | char *cp1 = vp1;
|
---|
16 | char *cp2 = vp2;
|
---|
17 |
|
---|
18 | while (--n >= 0)
|
---|
19 | if ((*cp1++ = *cp2++) == c)
|
---|
20 | return(cp1);
|
---|
21 |
|
---|
22 | return((void *)0);
|
---|
23 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.