Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / lib / strcspn.c
blob33a6628527780306d3e1e07eeca2e5abdc5c6ef8
1 /* Copyright (C) 1991, 1994, 1996-1997, 2002-2003 Free Software Foundation, Inc.
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.
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 2, or (at your option) any
9 later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 USA. */
21 #if HAVE_CONFIG_H
22 # include <config.h>
23 #endif
25 #include <stddef.h>
26 #include <string.h>
28 #undef strcspn
30 /* Return the length of the maximum initial segment of S
31 which contains no characters from REJECT. */
32 size_t
33 strcspn (const char *s, const char *reject)
35 size_t count = 0;
37 while (*s != '\0')
38 if (strchr (reject, *s++) == NULL)
39 ++count;
40 else
41 return count;
43 return count;