134438Sbostic/* 234438Sbostic * Copyright (c) 1988 Regents of the University of California. 334438Sbostic * All rights reserved. 434438Sbostic * 5*34824Sbostic * Redistribution and use in source and binary forms are permitted 6*34824Sbostic * provided that the above copyright notice and this paragraph are 7*34824Sbostic * duplicated in all such forms and that any documentation, 8*34824Sbostic * advertising materials, and other materials related to such 9*34824Sbostic * distribution and use acknowledge that the software was developed 10*34824Sbostic * by the University of California, Berkeley. The name of the 11*34824Sbostic * University may not be used to endorse or promote products derived 12*34824Sbostic * from this software without specific prior written permission. 13*34824Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*34824Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*34824Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16*34824Sbostic * 1734438Sbostic * This code is derived from software contributed to Berkeley by 1834438Sbostic * Computer Consoles Inc. 1934438Sbostic */ 2029700Ssam 2134438Sbostic#if defined(LIBC_SCCS) && !defined(lint) 22*34824Sbostic .asciz "@(#)strncat.s 1.4 (Berkeley) 06/27/88" 2334438Sbostic#endif /* LIBC_SCCS and not lint */ 2434438Sbostic 2529700Ssam/* 2629700Ssam * Concatenate s2 on the end of s1. S1's space must be large enough. 2729700Ssam * At most n characters are moved. 2829700Ssam * Return s1. 2929700Ssam * 3029700Ssam * char *strncat(s1, s2, n) 3129700Ssam * register char *s1, *s2; 3229700Ssam * register n; 3329700Ssam */ 3429700Ssam#include "DEFS.h" 3529700Ssam 3629700SsamENTRY(strncat, 0) 3729700Ssam tstl 12(fp) 3829700Ssam jgtr n_ok 3929700Ssam movl 4(fp),r0 4029700Ssam ret 4129700Ssamn_ok: 4229700Ssam movl 8(fp),r0 4329700Ssam movl r0,r1 4429700Ssam cmps2 # r0 points at null at end of s2 4529700Ssam subl3 8(fp),r0,r2 # r2 = numberof non-null chars in s2 4629700Ssam cmpl 12(fp),r2 4729700Ssam jgeq r2_ok 4829700Ssam movl 12(fp),r2 # r2 = min (n, length(s2)) 4929700Ssamr2_ok: 5029700Ssam movl 4(fp),r0 5129700Ssam movl r0,r1 5229700Ssam cmps2 # r1 points at null at end of s1 5329700Ssam movl 8(fp),r0 # source for copy 5429700Ssam movs3 # actual copy 5529700Ssam clrb (r1) # null terminated string ! 5629700Ssam movl 4(fp),r0 5729700Ssam ret 58