diff options
Diffstat (limited to 'src/lib9/strecpy.c')
-rw-r--r-- | src/lib9/strecpy.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib9/strecpy.c b/src/lib9/strecpy.c new file mode 100644 index 00000000..7d2f2277 --- /dev/null +++ b/src/lib9/strecpy.c @@ -0,0 +1,16 @@ +#include <lib9.h> + +char* +strecpy(char *to, char *e, char *from) +{ + if(to >= e) + return to; + to = memccpy(to, from, '\0', e - to); + if(to == nil){ + to = e - 1; + *to = '\0'; + }else{ + to--; + } + return to; +} |