File: strecpy.c

package info (click to toggle)
9base 1%3A6-13
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,488 kB
  • sloc: ansic: 61,051; yacc: 1,991; asm: 1,621; cs: 1,150; perl: 965; makefile: 616; sh: 18; sed: 4
file content (16 lines) | stat: -rw-r--r-- 208 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;
}