annotate lib/isblank.c @ 17616:cae23a655793

autoupdate
author Karl Berry <karl@freefriends.org>
date Sat, 25 Jan 2014 06:40:43 -0800
parents 344018b6e5d7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12184
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test whether a character is a blank.
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2
17587
344018b6e5d7 maint: update copyright
Eric Blake <eblake@redhat.com>
parents: 17249
diff changeset
3 Copyright (C) 2009-2014 Free Software Foundation, Inc.
12184
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 (at your option) any later version.
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #include <config.h>
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 /* Specification. */
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <ctype.h>
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 int
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 isblank (int c)
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 {
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 /* On all known platforms, in all predefined locales, isblank(c) is likely
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 equivalent with (c == ' ' || c == '\t'). Look at the glibc definition
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 (in glibc/localedata/locales/i18n): The "blank" characters are '\t', ' ',
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 U+1680, U+180E, U+2000..U+2006, U+2008..U+200A, U+205F, U+3000, and none
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 except the first two is present in a common 8-bit encoding. Therefore
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 the substitute for other platforms is not more complicated than this. */
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 return (c == ' ' || c == '\t');
d36f385f1f13 New module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 }