do
{
c = *s++;
s[off] = c;
}
while (c != '\0');
This is pretty much it. Some boundary checks. But THAT is it. And nearly all the files in glibc/string are like that.
update: (thx to Edd) the OpenBSD way of doing it
char *
strcpy(char *to, const char *from)
{
char *save = to;
for (; (*to = *from) != '\0'; ++from, ++to);
return(save);
}
No comments:
Post a Comment