.title concat .psect $code,rd,nowrt,exe,pic,shr,byte ; /* ; * Concatenate strings. ; * return a pointer to out ; */ ; ; char * ; concat(out, in1, in2, ... NULL) ; char *out; ; char *in1, in2, ... ; { ; register char **inp; ; ; for (inp = &in1; *inp != NULL; inp++) { ; strcat(out, *inp); ; } ; return(out); ; } .entry concat,^M addl3 #8,ap,r7 ; r7 -> 8(ap) (== in1) movl 4(ap),r6 ; r6 -> out loop: movl (r7),r2 ; r2 -> current in string beql done ; NULL terminates locc #0,#-1,(r2) ; r1 -> null at end of in[i] subl3 r2,r1,r1 ; r1 := length of in[i] incl r1 ; plus 1 for the null byte movc3 r1,@(r7)+,(r6) ; copy the string movl r3,r6 ; update the out pointer decl r6 ; r6 -> trailing null brb loop ; again if need be done: movl 4(ap),r0 ; return out ret ; bye. .end