strpbrk.c (77117) | strpbrk.c (86170) |
---|---|
1/* 2 * Copyright (c) 1985, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) 35static char sccsid[] = "@(#)strpbrk.c 8.1 (Berkeley) 6/4/93"; 36#endif /* LIBC_SCCS and not lint */ | 1/* 2 * Copyright (c) 1985, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) 35static char sccsid[] = "@(#)strpbrk.c 8.1 (Berkeley) 6/4/93"; 36#endif /* LIBC_SCCS and not lint */ |
37#ifndef lint 38static const char rcsid[] = 39 "$FreeBSD: head/lib/libc/string/strpbrk.c 77117 2001-05-24 08:47:42Z obrien $"; 40#endif 41 | |
42#include <sys/cdefs.h> | 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/lib/libc/string/strpbrk.c 86170 2001-11-07 19:55:16Z obrien $"); 39 |
|
43#include <string.h> 44 45/* 46 * Find the first occurrence in s1 of a character in s2 (excluding NUL). 47 */ 48char * 49strpbrk(s1, s2) 50 register const char *s1, *s2; 51{ 52 register const char *scanp; 53 register int c, sc; 54 55 while ((c = *s1++) != 0) { 56 for (scanp = s2; (sc = *scanp++) != 0;) 57 if (sc == c) 58 return ((char *)(s1 - 1)); 59 } 60 return (NULL); 61} | 40#include <string.h> 41 42/* 43 * Find the first occurrence in s1 of a character in s2 (excluding NUL). 44 */ 45char * 46strpbrk(s1, s2) 47 register const char *s1, *s2; 48{ 49 register const char *scanp; 50 register int c, sc; 51 52 while ((c = *s1++) != 0) { 53 for (scanp = s2; (sc = *scanp++) != 0;) 54 if (sc == c) 55 return ((char *)(s1 - 1)); 56 } 57 return (NULL); 58} |