142081Sbostic/*- 2*61222Sbostic * Copyright (c) 1990, 1993 3*61222Sbostic * The Regents of the University of California. All rights reserved. 442081Sbostic * 542081Sbostic * %sccs.include.redist.c% 642081Sbostic */ 742081Sbostic 842081Sbostic#if defined(LIBC_SCCS) && !defined(lint) 9*61222Sbostic .asciz "@(#)strpbrk.s 8.1 (Berkeley) 06/04/93" 1042081Sbostic#endif /* LIBC_SCCS and not lint */ 1142081Sbostic 1242081Sbostic/* 1342081Sbostic * Find in s1 the first occurrence of any character from s2. 1442081Sbostic * If there are none, return NULL. 1542081Sbostic * 1642081Sbostic * char * 1742081Sbostic * strpbrk(s1, s2) 1842081Sbostic * const char *s1, *s2; 1942081Sbostic */ 2042081Sbostic#include "DEFS.h" 2142081Sbostic 2242081SbosticENTRY(strpbrk, 0) 2342081Sbostic subl2 $32,sp /* make 256 bit table */ 2442081Sbostic movc5 $0,(sp),$0,$32,(sp) 2542081Sbostic movq 4(ap),r0 /* r0 = s1, r1 = s2 */ 2642081Sbostic 2742081Sbostic /* turn on bit for each character in s2, including '\0' */ 2842081Sbostic1: 2942081Sbostic movzbl (r1)+,r2 3042081Sbostic bbss r2,(sp),1b 3142081Sbostic bneq 1b 3242081Sbostic 3342081Sbostic /* look for a character that is in s2 */ 3442081Sbostic2: 3542081Sbostic movzbl (r0)+,r2 /* c = *s++ */ 3642081Sbostic bbc r2,(sp),2b /* loop until c is in table */ 3742081Sbostic beql 3f /* if c==0, go return NULL */ 3842081Sbostic decl r0 /* s-- */ 3942081Sbostic ret 4042081Sbostic3: 4142081Sbostic clrl r0 4242081Sbostic ret 43