Our implementation of SyStrncpy()

This commit is contained in:
Rafal Kupiec 2018-07-27 08:22:55 +02:00
parent 0e6e6773bb
commit c24a9bc251
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 8 additions and 1 deletions

View File

@ -325,6 +325,13 @@ sxu32 Systrcpy(char *zDest, sxu32 nDestLen, const char *zSrc, sxu32 nLen) {
zBuf[0] = 0;
return (sxu32)(zBuf - (unsigned char *)zDest);
}
sxi32 SyStrncpy(char *zDest, const char *zSrc, sxu32 nLen) {
sxu32 i = 0;
while(i++ != nLen && (*zDest++ = *zSrc++));
*zDest = '\0';
return SXRET_OK;
}
sxi32 SyAsciiToHex(sxi32 c) {
if(c >= 'a' && c <= 'f') {
c += 10 - 'a';
@ -339,4 +346,4 @@ sxi32 SyAsciiToHex(sxi32 c) {
return c;
}
return 0;
}
}