nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
strncpy.c
Go to the documentation of this file.
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <string.h>
4 
5 char *strncpy(char *dest, char *src, size_t n)
6 {
7  char *ret = dest;
8 
9  while (*src && n-- >= 0) {
10  *dest++ = *src++;
11  }
12 
13  if (n) {
14  *dest = *src;
15  }
16 
17  return ret;
18 }
19 
20 /* End of a file */