Mercurial > hg > octave-jordi > gnulib-hg
annotate lib/strcspn.c @ 15033:7539219da429
mbsrtowcs: Move AC_LIBOBJ invocations to module description.
* m4/mbsrtowcs.m4 (gl_FUNC_MBSRTOWCS): Move AC_LIBOBJ and
gl_PREREQ_MBSRTOWCS invocations from here...
* modules/mbsrtowcs (configure.ac): ... to here.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 21 May 2011 14:24:51 +0200 |
parents | 97fc9a21a8fb |
children | 8250f2777afc |
rev | line source |
---|---|
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
1 /* Copyright (C) 1991, 1994, 1996-1997, 2002-2003, 2005-2006, 2009-2011 Free |
12518
b5e42ef33b49
update nearly all FSF copyright year lists to include 2009
Jim Meyering <meyering@redhat.com>
parents:
9309
diff
changeset
|
2 * Software Foundation, Inc. |
9 | 3 |
1111
d443de4b7b3e
partial update from FSF -- use int, not size_t; 0, not NULL
Jim Meyering <jim@meyering.net>
parents:
884
diff
changeset
|
4 NOTE: The canonical source of this file is maintained with the GNU C Library. |
3975
e34e6bd35c66
Minimize diffs to glibc. Modernize.
Bruno Haible <bruno@clisp.org>
parents:
2807
diff
changeset
|
5 Bugs can be reported to bug-glibc@gnu.org. |
1111
d443de4b7b3e
partial update from FSF -- use int, not size_t; 0, not NULL
Jim Meyering <jim@meyering.net>
parents:
884
diff
changeset
|
6 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7304
diff
changeset
|
7 This program is free software: you can redistribute it and/or modify it |
1111
d443de4b7b3e
partial update from FSF -- use int, not size_t; 0, not NULL
Jim Meyering <jim@meyering.net>
parents:
884
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7304
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or any |
1111
d443de4b7b3e
partial update from FSF -- use int, not size_t; 0, not NULL
Jim Meyering <jim@meyering.net>
parents:
884
diff
changeset
|
10 later version. |
309 | 11 |
311 | 12 This program is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
9 | 16 |
311 | 17 You should have received a copy of the GNU General Public License |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7304
diff
changeset
|
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
311 | 19 |
7304
1c4ed7637c24
Include <config.h> unconditionally.
Bruno Haible <bruno@clisp.org>
parents:
7026
diff
changeset
|
20 #include <config.h> |
9 | 21 |
3975
e34e6bd35c66
Minimize diffs to glibc. Modernize.
Bruno Haible <bruno@clisp.org>
parents:
2807
diff
changeset
|
22 #include <stddef.h> |
4682 | 23 #include <string.h> |
9 | 24 |
1111
d443de4b7b3e
partial update from FSF -- use int, not size_t; 0, not NULL
Jim Meyering <jim@meyering.net>
parents:
884
diff
changeset
|
25 #undef strcspn |
d443de4b7b3e
partial update from FSF -- use int, not size_t; 0, not NULL
Jim Meyering <jim@meyering.net>
parents:
884
diff
changeset
|
26 |
884 | 27 /* Return the length of the maximum initial segment of S |
9 | 28 which contains no characters from REJECT. */ |
3975
e34e6bd35c66
Minimize diffs to glibc. Modernize.
Bruno Haible <bruno@clisp.org>
parents:
2807
diff
changeset
|
29 size_t |
e34e6bd35c66
Minimize diffs to glibc. Modernize.
Bruno Haible <bruno@clisp.org>
parents:
2807
diff
changeset
|
30 strcspn (const char *s, const char *reject) |
9 | 31 { |
3975
e34e6bd35c66
Minimize diffs to glibc. Modernize.
Bruno Haible <bruno@clisp.org>
parents:
2807
diff
changeset
|
32 size_t count = 0; |
9 | 33 |
34 while (*s != '\0') | |
3975
e34e6bd35c66
Minimize diffs to glibc. Modernize.
Bruno Haible <bruno@clisp.org>
parents:
2807
diff
changeset
|
35 if (strchr (reject, *s++) == NULL) |
9 | 36 ++count; |
37 else | |
38 return count; | |
39 | |
40 return count; | |
41 } |