taskfs fix up, minor refactoring
[lunaix-os.git] / lunaix-os / libs / klibc / string / strcpy.c
index 4002d5b5e546acb788e26847e4122aa5a7a87467..400aeec4ae1c52ade64a890db2a41ab5ebdd5a48 100644 (file)
@@ -1,7 +1,7 @@
 #include <klibc/string.h>
 #include <lunaix/compiler.h>
 
-char* weak
+char* _weak
 strcpy(char* dest, const char* src)
 {
     char c;
@@ -24,21 +24,16 @@ strcpy(char* dest, const char* src)
  * @param n 
  * @return char* 
  */
-char* weak
+char* _weak
 strncpy(char* dest, const char* src, unsigned long n)
 {
-    char c;
+    char c = '\0';
     unsigned int i = 0;
-    while (i <= n && (c = src[i]))
+    while (i < n && (c = src[i]))
         dest[i++] = c;
 
-    if (!(n < i && src[i - 1])) {
-        while (i <= n)
-            dest[i++] = 0;
-    }
-    else {
-        dest[i - 1] = 0;
-    }
+    while (i < n)
+        dest[i++] = 0;
     
     return dest;
 }
\ No newline at end of file