summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-07-06 17:43:05 +0000
committerEric Andersen <andersen@codepoet.org>2001-07-06 17:43:05 +0000
commit9f26cdeaec4b93ea50ed43572daecde8b7312a85 (patch)
tree49eee35da1ac27b83ea222dd1f40dcb443e759a1 /libc
parent8c96e2548ac132cd73b08a4553d797f85e1e96b3 (diff)
Fix strxfrm, which was broken (thanks to Shaya Potter <spotter@us.ibm.com>
for noticing, and cleanup a warning. -Erik
Diffstat (limited to 'libc')
-rw-r--r--libc/string/string.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libc/string/string.c b/libc/string/string.c
index 0a1ced8b3..4a367b561 100644
--- a/libc/string/string.c
+++ b/libc/string/string.c
@@ -63,8 +63,6 @@ char *strcpy(char *dst, const char *src)
#ifdef L_stpcpy
char *stpcpy(char *dst, const char *src)
{
- register char *ptr = dst;
-
while (*src)
*dst++ = *src++;
*dst = '\0';
@@ -164,7 +162,11 @@ char *strncpy(char *dst, const char *src, size_t len)
#ifdef L_strxfrm
size_t strxfrm(char *dst, const char *src, size_t len)
{
+ size_t length;
strncpy( dst, src, len);
+ length = strlen(src);
+ if (length<len)
+ return(length);
return( len);
}
#endif