summaryrefslogtreecommitdiff
path: root/fmt_strn.c
blob: 3ef58a64c6ddb403b181c689c27bcfe17ddde9ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include "fmt.h"

unsigned int fmt_strn(s,t,n)
register char *s; register char *t; register unsigned int n;
{
  register unsigned int len;
  char ch;
  len = 0;
  if (s) { while (n-- && (ch = t[len])) s[len++] = ch; }
  else while (n-- && t[len]) len++;
  return len;
}