diff options
Diffstat (limited to 'steccpy.c')
-rw-r--r-- | steccpy.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/steccpy.c b/steccpy.c new file mode 100644 index 0000000..3bf8da1 --- /dev/null +++ b/steccpy.c @@ -0,0 +1,16 @@ +char * +steccpy(char *dst, char *end, const char *src, int c) +{ + if (dst >= end) + return dst; + + while (dst < end && *src != c && (*dst = *src)) + src++, dst++; + + if (dst == end) + dst[-1] = 0; + else if (*src == c) + dst[0] = 0; + + return dst; +} |