core/logic/stringutil.cpp
changeset 3004 e3ac0dc6d9a4
parent 3002 409a6de13f09
child 3005 2db965f8db3f
     1.1 --- a/core/logic/stringutil.cpp	Fri May 14 19:43:38 2010 -0700
     1.2 +++ b/core/logic/stringutil.cpp	Fri May 14 19:43:53 2010 -0700
     1.3 @@ -64,4 +64,21 @@
     1.4  	return NULL;
     1.5  }
     1.6  
     1.7 +unsigned int strncopy(char *dest, const char *src, size_t count)
     1.8 +{
     1.9 +	if (!count)
    1.10 +	{
    1.11 +		return 0;
    1.12 +	}
    1.13  
    1.14 +	char *start = dest;
    1.15 +	while ((*src) && (--count))
    1.16 +	{
    1.17 +		*dest++ = *src++;
    1.18 +	}
    1.19 +	*dest = '\0';
    1.20 +
    1.21 +	return (dest - start);
    1.22 +}
    1.23 +
    1.24 +