xref: /third_party/musl/porting/linux/user/src/string/strncpy.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/musl/porting/linux/user/src/string/
1570af302Sopenharmony_ci#include <string.h>
2570af302Sopenharmony_ci
3570af302Sopenharmony_cichar *strncpy(char *dst, const char *src, size_t n)
4570af302Sopenharmony_ci{
5570af302Sopenharmony_ci	char *d = dst, *s = src;
6570af302Sopenharmony_ci	while (n > 0){
7570af302Sopenharmony_ci		if((*d = *s) != 0){
8570af302Sopenharmony_ci			s++;
9570af302Sopenharmony_ci		}
10570af302Sopenharmony_ci		d++;
11570af302Sopenharmony_ci		n--;
12570af302Sopenharmony_ci	}
13570af302Sopenharmony_ci	return (dst);
14570af302Sopenharmony_ci}

Indexes created Thu Nov 07 10:32:03 CST 2024