refactor: add a async read/write variant to device ops, with allow async io to be...
[lunaix-os.git] / lunaix-os / libs / klibc / string / strcpy.c
index 12586064cd6767fe36abb89139dc4eb2f180a45a..88b5cb1ca2a02ab298e6f8b8a0532e59bcd0b454 100644 (file)
@@ -1,11 +1,11 @@
 #include <klibc/string.h>
 
 char*
-strcpy(char* dest, const char* src) {
+strcpy(char* dest, const char* src)
+{
     char c;
     unsigned int i = 0;
-    while ((c = src[i]))
-    {
+    while ((c = src[i])) {
         dest[i] = c;
         i++;
     }
@@ -14,10 +14,13 @@ strcpy(char* dest, const char* src) {
 }
 
 char*
-strncpy(char* dest, const char* src, size_t n) {
+strncpy(char* dest, const char* src, unsigned long n)
+{
     char c;
     unsigned int i = 0;
-    while ((c = src[i]) && i < n) dest[i++] = c;
-    while (i < n) dest[i++] = 0;
+    while ((c = src[i]) && i <= n)
+        dest[i++] = c;
+    while (i <= n)
+        dest[i++] = 0;
     return dest;
 }
\ No newline at end of file