|
|
1.1 ! root 1: ! 2: /* ! 3: * strcatn.s 4.1 (Tahoe) June 1983 ! 4: * ! 5: * Concatenate s2 on the end of s1. S1's space must be large enough. ! 6: * At most n characters are moved. ! 7: * Return s1. ! 8: * ! 9: * char *strcatn(s1, s2, n) ! 10: * register char *s1, *s2; ! 11: * register n; ! 12: */ ! 13: ! 14: .text ! 15: .globl _strcatn ! 16: .align 1 ! 17: _strcatn: ! 18: .word 4 # saves r2 ! 19: ! 20: tstl 12(fp) ! 21: jgtr n_ok ! 22: movl 4(fp),r0 ! 23: clrb (r0) ! 24: ret ! 25: n_ok: ! 26: movl 8(fp),r0 ! 27: movl r0,r1 ! 28: cmps2 # r0 points at null at end of s2 ! 29: subl3 8(fp),r0,r2 # r2 = numberof non-null chars in s2 ! 30: cmpl 12(fp),r2 ! 31: jgeq r2_ok ! 32: movl 12(fp),r2 # r2 = min (n, length(s2)) ! 33: r2_ok: ! 34: movl 4(fp),r0 ! 35: movl r0,r1 ! 36: cmps2 # r1 points at null at end of s1 ! 37: movl 8(fp),r0 # source for copy ! 38: movs3 # actual copy ! 39: clrb (r1) # null terminated string ! ! 40: movl 4(fp),r0 ! 41: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.