xref: /netbsd-src/external/gpl3/gdb/dist/gnulib/import/isblank.c (revision 4b169a6ba595ae283ca507b26b15fdff40495b1c)
18dffb485Schristos /* Test whether a character is a blank.
28dffb485Schristos 
3*4b169a6bSchristos    Copyright (C) 2009-2022 Free Software Foundation, Inc.
48dffb485Schristos 
5*4b169a6bSchristos    This file is free software: you can redistribute it and/or modify
6*4b169a6bSchristos    it under the terms of the GNU Lesser General Public License as
7*4b169a6bSchristos    published by the Free Software Foundation; either version 2.1 of the
8*4b169a6bSchristos    License, or (at your option) any later version.
98dffb485Schristos 
10*4b169a6bSchristos    This file is distributed in the hope that it will be useful,
118dffb485Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
128dffb485Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*4b169a6bSchristos    GNU Lesser General Public License for more details.
148dffb485Schristos 
15*4b169a6bSchristos    You should have received a copy of the GNU Lesser General Public License
168dffb485Schristos    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
178dffb485Schristos 
188dffb485Schristos #include <config.h>
198dffb485Schristos 
208dffb485Schristos /* Specification.  */
218dffb485Schristos #include <ctype.h>
228dffb485Schristos 
238dffb485Schristos int
isblank(int c)248dffb485Schristos isblank (int c)
258dffb485Schristos {
268dffb485Schristos   /* On all known platforms, in all predefined locales, isblank(c) is likely
278dffb485Schristos      equivalent with  (c == ' ' || c == '\t').  Look at the glibc definition
288dffb485Schristos      (in glibc/localedata/locales/i18n): The "blank" characters are '\t', ' ',
298dffb485Schristos      U+1680, U+180E, U+2000..U+2006, U+2008..U+200A, U+205F, U+3000, and none
308dffb485Schristos      except the first two is present in a common 8-bit encoding.  Therefore
318dffb485Schristos      the substitute for other platforms is not more complicated than this.  */
328dffb485Schristos   return (c == ' ' || c == '\t');
338dffb485Schristos }
34