diff options
author | Leah Neukirchen <leah@vuxu.org> | 2023-11-03 18:13:05 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2024-07-14 14:50:01 +0200 |
commit | 10374ca23413c7e2f85a8b773f90250b5408195e (patch) | |
tree | ea07fd347ae9eb286923c8d64fb680aaa1aa374c /steccpy.c | |
parent | fce8d1ec3329a97fc8886cf71eb3d1a763d71ad7 (diff) | |
download | libste-10374ca23413c7e2f85a8b773f90250b5408195e.tar.gz libste-10374ca23413c7e2f85a8b773f90250b5408195e.tar.xz libste-10374ca23413c7e2f85a8b773f90250b5408195e.zip |
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; +} |