.title gtftok ;+ ; integer function gtftok(buf, i, token) ;- buf=4 i=8 token=12 .psect st_pure_code rel,con,lcl,exe,nowrt,rd,pic,shr,usr,novec,long .entry gtftok ^m movl buf(ap),r1 ; address of buf(1) movl i(ap),r3 ; address of i decl (r3) ; i = i - 1 addl2 (r3),r1 ; address of buf(i) movl token(ap),r2 ; address of token(1) clrl r0 ; initialize return count incl (r3) ; i = i + 1 cmpb (r1),#^a"/" ; buf(i) == SLASH? bneq 10$ ; NO incl (r3) ; i = i + 1 incl r1 ; address of buf(i) 10$: movb (r1)+,(r2) ; copy character beql 30$ ; if == 0, done cmpb (r2),#^a"/" ; SLASH? beql 20$ ; YES incl r0 ; increment count incl (r3) ; i = i + 1 cmpb (r2)+,#^a"\" ; BACKSLASH? bneq 10$ ; NO, do next character 20$: clrb (r2) ; terminate with EOS 30$: ret .end