Initial revision
[reactos.git] / reactos / lib / crtdll / string / strncpy.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2 #include <string.h>
3
4 char *
5 strncpy(char *dst, const char *src, size_t n)
6 {
7 if (n != 0) {
8 char *d = dst;
9 const char *s = src;
10
11 do {
12 if ((*d++ = *s++) == 0)
13 {
14 while (--n != 0)
15 *d++ = 0;
16 break;
17 }
18 } while (--n != 0);
19 }
20 return dst;
21 }