Last change
on this file since a838f5b was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
673 bytes
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | memccpy.c -- copy bytes until character seen
|
---|
4 | Version 1 -- 1987-06-12
|
---|
5 |
|
---|
6 | Copy s2 to s1, 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 | char *
|
---|
14 | memccpy(s1, s2, c, n)
|
---|
15 | register char *s1, *s2;
|
---|
16 | register char c;
|
---|
17 | register int n;
|
---|
18 | {
|
---|
19 | while (--n >= 0)
|
---|
20 | if ((*s1++ = *s2++) == c)
|
---|
21 | return(s1);
|
---|
22 | return((char *)0);
|
---|
23 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.