summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/strncat.c
blob: 1d3b94ca51d4c0360caae144bbb0d78003f1287a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "dietfeatures.h"
#include <string.h>

char *strncat(char *s, const char *t, size_t n) {
  char *dest=s;
  register char *max=s+n-1;
  s+=strlen(s);
  for (;;) {
    if (!(*s = *t)) break; if (++s==max) break; ++t;
#ifndef WANT_SMALL_STRING_ROUTINES
    if (!(*s = *t)) break; if (++s==max) break; ++t;
    if (!(*s = *t)) break; if (++s==max) break; ++t;
    if (!(*s = *t)) break; if (++s==max) break; ++t;
#endif
  }
  *s=0;
  return dest;
}