Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jul 1997 12:51:26 -0400 (EDT)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        "Jonathan M. Bresler" <jmb@FreeBSD.ORG>
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: ispunct(3) [was: FreeBSD-2.1.1]
Message-ID:  <199707141651.MAA07262@khavrinen.lcs.mit.edu>
In-Reply-To: <199707141611.JAA29062@hub.freebsd.org>
References:  <19970714152834.RR49021@uriah.heep.sax.de> <199707141611.JAA29062@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Mon, 14 Jul 1997 09:11:20 -0700 (PDT), "Jonathan M. Bresler" <jmb@FreeBSD.ORG> said:

> 	ispunct() is only useful for ASCII input.
> 	the correct way to use ispunct() and the rest of the functions
> 	listed in ctype(3) is to call isascii() first

BZZZZT!

There is no such thing as isascii() in Standard C.  The domain of all
of the ctype(3) functions, as Bruce noted earlier in this thread, is
[UCHAR_MIN,UCHAR_MAX] union {EOF}.


wollman@khavrinen(173)$ cat >foo.c
#include <ctype.h>
#include <limits.h> 
#include <stdio.h>

int
main(void)
{
        int c;

        for (c = UCHAR_MIN; c < UCHAR_MAX; c++) {
                if (ispunct(c))
                        putchar(c);
        }
        putchar('\n');
        if (ispunct(EOF))
                printf("EOF\n");
        return 0;
}
wollman@khavrinen(174)$ cc -o foo foo.c
wollman@khavrinen(175)$ ./foo
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿×÷
wollman@khavrinen(176)$ 

In case you can't read the high-bit characters there, they are all the
punctuation characters from the ISO 8859-1 (``Latin 1'') character
set.

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman@lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707141651.MAA07262>