#include <string.h>

char *strncpy(char *s1,const char *s2,size_t n)
{
    char *d=s1,c;
    while(n&&(c=*s2++,*s1++=c,c)) n--;
    return(d);
}
