Last change
on this file since 210d896 was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Zero redundant declarations.
|
-
Property mode
set to
100644
|
File size:
514 bytes
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | strncpy.c -- copy string of n bytes
|
---|
4 | Version 1 -- 1987-06-12
|
---|
5 |
|
---|
6 | Copy s2 to s1, truncating or null-padding to always copy n bytes
|
---|
7 | return s1
|
---|
8 | =============================================================================
|
---|
9 | */
|
---|
10 |
|
---|
11 | #include "ram.h"
|
---|
12 |
|
---|
13 | int8_t *strncpy(int8_t *s1, int8_t *s2, int16_t n)
|
---|
14 | {
|
---|
15 | register int8_t *os1 = s1;
|
---|
16 |
|
---|
17 | while (--n >= 0)
|
---|
18 | if ((*s1++ = *s2++) == '\0')
|
---|
19 | while (--n >= 0)
|
---|
20 | *s1++ = '\0';
|
---|
21 |
|
---|
22 | return (os1);
|
---|
23 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.