1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8#if defined(LIBC_SCCS) && !defined(lint) 9 .asciz "@(#)strpbrk.s 8.1 (Berkeley) 06/04/93" 10#endif /* LIBC_SCCS and not lint */ 11 12/* 13 * Find in s1 the first occurrence of any character from s2. 14 * If there are none, return NULL. 15 * 16 * char * 17 * strpbrk(s1, s2) 18 * const char *s1, *s2; 19 */ 20#include "DEFS.h" 21 22ENTRY(strpbrk, 0) 23 subl2 $32,sp /* make 256 bit table */ 24 movc5 $0,(sp),$0,$32,(sp) 25 movq 4(ap),r0 /* r0 = s1, r1 = s2 */ 26 27 /* turn on bit for each character in s2, including '\0' */ 281: 29 movzbl (r1)+,r2 30 bbss r2,(sp),1b 31 bneq 1b 32 33 /* look for a character that is in s2 */ 342: 35 movzbl (r0)+,r2 /* c = *s++ */ 36 bbc r2,(sp),2b /* loop until c is in table */ 37 beql 3f /* if c==0, go return NULL */ 38 decl r0 /* s-- */ 39 ret 403: 41 clrl r0 42 ret 43