]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libc/port/utfecpy.c
libregexp: improve the transition to next available thread, instruction, and generation
[plan9front.git] / sys / src / libc / port / utfecpy.c
1 #include <u.h>
2 #include <libc.h>
3
4 char*
5 utfecpy(char *to, char *e, char *from)
6 {
7         char *end;
8
9         if(to >= e)
10                 return to;
11         end = memccpy(to, from, '\0', e - to);
12         if(end == nil){
13                 end = e;
14                 while(end>to && (*--end&0xC0)==0x80)
15                         ;
16                 *end = '\0';
17         }else{
18                 end--;
19         }
20         return end;
21 }