• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/gettext-0.17/gettext-tools/gnulib-lib/
1/* Copyright (C) 1991, 1994, 1996-1997, 2002-2003, 2005-2006 Free Software Foundation, Inc.
2
3   NOTE: The canonical source of this file is maintained with the GNU C Library.
4   Bugs can be reported to bug-glibc@gnu.org.
5
6   This program is free software: you can redistribute it and/or modify it
7   under the terms of the GNU General Public License as published by the
8   Free Software Foundation; either version 3 of the License, or any
9   later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19#include <config.h>
20
21#include <stddef.h>
22#include <string.h>
23
24#undef strcspn
25
26/* Return the length of the maximum initial segment of S
27   which contains no characters from REJECT.  */
28size_t
29strcspn (const char *s, const char *reject)
30{
31  size_t count = 0;
32
33  while (*s != '\0')
34    if (strchr (reject, *s++) == NULL)
35      ++count;
36    else
37      return count;
38
39  return count;
40}
41