sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * FUNCTION sl@0: * <>---find chars in string sl@0: * INDEX sl@0: * strpbrk sl@0: * ANSI_SYNOPSIS sl@0: * #include sl@0: * char *strpbrk(const char *<[s1]>, const char *<[s2]>); sl@0: * TRAD_SYNOPSIS sl@0: * #include sl@0: * char *strpbrk(<[s1]>, <[s2]>) sl@0: * char *<[s1]>; sl@0: * char *<[s2]>; sl@0: * This function locates the first occurence in the string sl@0: * pointed to by <[s1]> of any character in string pointed to by sl@0: * <[s2]> (excluding the terminating null character). sl@0: * RETURNS sl@0: * <> returns a pointer to the character found in <[s1]>, or a sl@0: * null pointer if no character from <[s2]> occurs in <[s1]>. sl@0: * PORTABILITY sl@0: * <> requires no supporting OS subroutines. sl@0: * sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #include sl@0: sl@0: /** sl@0: Scan string for specified characters. sl@0: Scans string1 character by character, returning a pointer to the first character sl@0: that matches with any of the characters in string2. sl@0: The search does not includes the terminating null-characters. sl@0: @return A pointer to the first appearance in string1 of a character specified in s2. sl@0: If none of the characters specified in s2 exists in s1, a NULL pointer is returned. sl@0: @param s1 Null-terminated string to be scanned. sl@0: @param s2 Null-terminated string containing the character set to search for. sl@0: */ sl@0: EXPORT_C char * sl@0: strpbrk (const char *s1, const char *s2) sl@0: { sl@0: const char *c = s2; sl@0: if (!*s1) sl@0: return (char *) NULL; sl@0: sl@0: while (*s1) sl@0: { sl@0: for (c = s2; *c; c++) sl@0: { sl@0: if (*s1 == *c) sl@0: break; sl@0: } sl@0: if (*c) sl@0: break; sl@0: s1++; sl@0: } sl@0: sl@0: if (*c == '\0') sl@0: s1 = NULL; sl@0: sl@0: return (char *) s1; sl@0: }