00001 00007 /* Embedded XINU, Copyright (C) 2007. All rights reserved. */ 00008 00016 char *strncpy(char *s1, char *s2, int n) 00017 { 00018 register int i; 00019 register char *os1; 00020 00021 os1 = s1; 00022 for (i = 0; i < n; i++) 00023 { 00024 if (((*s1++) = (*s2++)) == '\0') 00025 { 00026 while (++i < n) 00027 { *s1++ = '\0'; } 00028 return os1; 00029 } 00030 } 00031 return os1; 00032 }