Re: The isspace(3) man page is out of date

Jeff Johnston <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAOox84sgTL07OaOek5VLFt8eyFrRrKwMQ=SkeEjs-hUXRmwjHw@mail.gmail.com>
Patch manually typed in (please attach patches in the future so e-mail
tools don't mess with the patch).

Thanks,

-- Jeff J.

On Fri, Aug 7, 2026 at 6:01 PM Keith Thompson <[email protected]>
wrote:

> The isspace(3) man page incorrectly states that isspace(c) is defined
> only when isascii(c) is true or c is EOF.
>
> In fact, ISO C (going back to C89/C90) requires isspace(c) to work
> correctly when c is either within the range of unsigned char or equal
> to EOF (almost certainly 0..255 or -1 for systems supported by
> newlib). The implementation of isspace() is correct; this is only a
> documentation issue.
>
> The other is*() functions work correctly and are documented correctly.
>
> The following patch fixes this by copying the wording from isalpha().
>
> I have *not* updated it to clarify just what "whitespace" means, but
> it would probably be a good idea.
>
> commit 932bca35395f3fc920b8d90b1f4bc07dc13efb93 (HEAD -> isspace-man-page)
> Author: Keith Thompson <[email protected]>
> Date:   2026-08-07 14:50:36 -0700
>
>     Correct isspace(3) man page (copied wording from isalpha(3))
>
> diff --git newlib/libc/ctype/isspace.c newlib/libc/ctype/isspace.c
> index 0def2c0ce..784f4d7ae 100644
> --- newlib/libc/ctype/isspace.c
> +++ newlib/libc/ctype/isspace.c
> @@ -18,7 +18,8 @@ SYNOPSIS
>  DESCRIPTION
>  <<isspace>> is a macro which classifies singlebyte charset values by table
>  lookup.  It is a predicate returning non-zero for whitespace
> -characters, and 0 for other characters.  It is defined only when
> <<isascii>>(<[c]>) is true or <[c]> is EOF.
> +characters, and 0 for other characters.  It is defined only if
> +<[c]> is representable as an unsigned char or if <[c]> is EOF.
>
>  <<isspace_l>> is like <<isspace>> but performs the check based on the
>  locale specified by the locale object locale.  If <[locale]> is
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.