Commit | Line | Data |
---|---|---|
f2e8263d RE |
1 | /* |
2 | * Copyright (c) 1985 Regents of the University of California. | |
317e5946 KB |
3 | * All rights reserved. |
4 | * | |
019bea33 | 5 | * %sccs.include.redist.c% |
f2e8263d RE |
6 | */ |
7 | ||
2ce81398 | 8 | #if defined(LIBC_SCCS) && !defined(lint) |
a64329b4 | 9 | static char sccsid[] = "@(#)strpbrk.c 5.8 (Berkeley) %G%"; |
317e5946 | 10 | #endif /* LIBC_SCCS and not lint */ |
f2e8263d | 11 | |
a64329b4 | 12 | #include <sys/cdefs.h> |
62e67295 | 13 | #include <string.h> |
62e67295 KB |
14 | |
15 | /* | |
16 | * Find the first occurrence in s1 of a character in s2 (excluding NUL). | |
17 | */ | |
f2e8263d | 18 | char * |
a02e5b51 | 19 | strpbrk(s1, s2) |
62e67295 | 20 | register const char *s1, *s2; |
f2e8263d | 21 | { |
62e67295 | 22 | register const char *scanp; |
a02e5b51 | 23 | register int c, sc; |
f2e8263d | 24 | |
62e67295 KB |
25 | while ((c = *s1++) != 0) { |
26 | for (scanp = s2; (sc = *scanp++) != 0;) | |
a02e5b51 | 27 | if (sc == c) |
62e67295 KB |
28 | return ((char *)(s1 - 1)); |
29 | } | |
30 | return (NULL); | |
f2e8263d | 31 | } |