Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 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
}