UbixOS V2  2.0
strncpy.c
Go to the documentation of this file.
1 #include <string.h>
2 
3 char *strncpy(char * __restrict dst, const char * __restrict src, size_t n) {
4  if (n != 0) {
5  char *d = dst;
6  const char *s = src;
7 
8  do {
9  if ((*d++ = *s++) == 0) {
10  /* NUL pad the remaining n-1 bytes */
11  while (--n != 0)
12  *d++ = 0;
13  break;
14  }
15  } while (--n != 0);
16  }
17  return (dst);
18 }
strncpy
char * strncpy(char *__restrict dst, const char *__restrict src, size_t n)
Definition: strncpy.c:3
string.h
__restrict
#define __restrict
Definition: cdefs.h:435