aboutsummaryrefslogtreecommitdiff
path: root/sys/libc/strncat.c
blob: 9deae4ebdd8e846f207a3f34b880f456b3f8e7c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
*/

#define	import_libc
#include <iraf.h>


/* STRNCAT -- Concatenate at most N chars from S2 onto S1.
*/
char *
strncat (
  char	*s1,			/* output string		*/
  char	*s2,			/* string to be appended	*/
  int	n		/* max length of S1		*/
)
{
	register char	*ip, *op;

	for (op=s1;  *op++;  )
	    ;
	for (--op, ip=s2;  (*op++ = *ip++) && --n >= 0;  )
	    ;
	*--op = '\0';

	return (s1);
}