source: trunk/sys/dietlibc/strncpy.c @ 124

Last change on this file since 124 was 1, checked in by alain, 8 years ago

First import

File size: 493 bytes
RevLine 
[1]1#define _POSIX_SOURCE
2#define _XOPEN_SOURCE
3
4#include <string.h>
5#include "dietfeatures.h"
6
7/* gcc is broken and has a non-SUSv2 compliant internal prototype.
8 * This causes it to warn about a type mismatch here.  Ignore it. */
9char *strncpy(char *dest, const char *src, size_t n) {
10#ifdef WANT_FULL_POSIX_COMPAT
11  memset(dest,0,n);
12#endif
13  memccpy(dest,src,0,n);
14#ifdef WANT_NON_COMPLIANT_STRNCAT
15  if (n) dest[n-1]=0;   /* maybe we should rather abort() if n is 0? */
16#endif
17  return dest;
18}
Note: See TracBrowser for help on using the repository browser.