source: trunk/sys/dietlibc/strncat.c @ 24

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

First import

File size: 620 bytes
Line 
1#include "dietfeatures.h"
2#include <string.h>
3
4/* gcc is broken and has a non-SUSv2 compliant internal prototype.
5 * This causes it to warn about a type mismatch here.  Ignore it. */
6char *strncat(char *s, const char *t, size_t n) {
7  char *dest=s;
8  register char *max;
9  s+=strlen(s);
10  if ((max=s+n)==s) goto fini;
11  for (;;) {
12    if (!(*s = *t)) break; if (++s==max) break; ++t;
13#ifndef WANT_SMALL_STRING_ROUTINES
14    if (!(*s = *t)) break; if (++s==max) break; ++t;
15    if (!(*s = *t)) break; if (++s==max) break; ++t;
16    if (!(*s = *t)) break; if (++s==max) break; ++t;
17#endif
18  }
19  *s=0;
20fini:
21  return dest;
22}
Note: See TracBrowser for help on using the repository browser.