.title strncat String Concatenate .ident /000002/ ; ;+ ; ; Index Concatenate a string onto another, with count ; ; Usage ; ; char * ; strncat(out, in, count); ; char *out; ; char *in; ; unsigned int count; ; ; Description ; ; Append "in" to "out". Return out. ; At most, "count" bytes are moved from in. ; Note that "count" does not include the trailing null. ; ; Bugs ; ;- ; ; Edit history ; 000001 21-Oct-81 MM Initial edit ; 000002 8-Jul-82 JSL Use .sob ; .psect c$code strncat:: mov r2,-(sp) ; Get a temp mov 6+2(sp),r2 ; r2 = count ;02 beq 40$ ; nothing to do ;02 mov 2+2(sp),r0 ; r0 -> string1 (out) mov 4+2(sp),r1 ; r1 -> string2 (in) 10$: tstb (r0)+ ; Skip to the end bne 10$ ; of the output dec r0 ; buffer, r0 -> null trailer 20$: movb (r1)+,(r0)+ ; Output one byte beq 40$ ; Normal exit -- end of input .sob r2,20$ ; Repeat unless at counted end ;02 clrb (r0) ; Truncate output 40$: mov (sp)+,r2 ; Restore register mov 2(sp),r0 ; Return first arg. return .end