1139823Simp/* Copyright (C) 1991, 1994, 1996-1997, 2002-2003, 2005-2006 Free Software Foundation, Inc. 2122702Sandre 3122702Sandre NOTE: The canonical source of this file is maintained with the GNU C Library. 4122702Sandre Bugs can be reported to bug-glibc@gnu.org. 5122702Sandre 6122702Sandre This program is free software; you can redistribute it and/or modify it 7122702Sandre under the terms of the GNU General Public License as published by the 8122702Sandre Free Software Foundation; either version 2, or (at your option) any 9122702Sandre later version. 10122702Sandre 11122702Sandre This program is distributed in the hope that it will be useful, 12122702Sandre but WITHOUT ANY WARRANTY; without even the implied warranty of 13122702Sandre MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14122702Sandre GNU General Public License for more details. 15122702Sandre 16122702Sandre You should have received a copy of the GNU General Public License 17122702Sandre along with this program; if not, write to the Free Software Foundation, 18122702Sandre Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 19122702Sandre 20122702Sandre#include <config.h> 21122702Sandre 22122702Sandre#include <stddef.h> 23122702Sandre#include <string.h> 24122702Sandre 25122702Sandre#undef strcspn 26122702Sandre 27122702Sandre/* Return the length of the maximum initial segment of S 28122702Sandre which contains no characters from REJECT. */ 29122702Sandresize_t 30122702Sandrestrcspn (const char *s, const char *reject) 31122702Sandre{ 32122702Sandre size_t count = 0; 33122702Sandre 34122702Sandre while (*s != '\0') 35122702Sandre if (strchr (reject, *s++) == NULL) 36122702Sandre ++count; 37148324Skeramida else 38122702Sandre return count; 39122759Sandre 40122759Sandre return count; 41122759Sandre} 42122759Sandre