Last change
on this file since 0292fbb was 0580615, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Point of no return.
|
-
Property mode
set to
100644
|
File size:
533 bytes
|
Rev | Line | |
---|
[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | strncat.c -- concatenate strings
|
---|
| 4 | Version 1 -- 1987-06-12
|
---|
| 5 |
|
---|
| 6 | Concatenate s2 on the end of s1. S1's space must be large enough.
|
---|
| 7 | At most n characters are moved.
|
---|
| 8 | Return s1.
|
---|
| 9 | =============================================================================
|
---|
| 10 | */
|
---|
| 11 |
|
---|
[0580615] | 12 | char *strncat(char *s1, char *s2, int n)
|
---|
[f40a309] | 13 | {
|
---|
| 14 | register char *os1;
|
---|
| 15 |
|
---|
| 16 | os1 = s1;
|
---|
| 17 |
|
---|
| 18 | while(*s1++)
|
---|
| 19 | ;
|
---|
| 20 |
|
---|
| 21 | --s1;
|
---|
| 22 |
|
---|
| 23 | while(*s1++ = *s2++)
|
---|
| 24 | if(--n < 0) {
|
---|
| 25 |
|
---|
| 26 | *--s1 = '\0';
|
---|
| 27 | break;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | return(os1);
|
---|
| 31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.