Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jul 1997 19:31:38 +0200
From:      j@uriah.heep.sax.de (J Wunsch)
To:        r.carey@dcs.napier.ac.uk (Robin Carey)
Cc:        hoek@hwcn.org (Tim Vanderhoek), freebsd-bugs@FreeBSD.ORG
Subject:   Re: ispunct(3) [was: FreeBSD-2.1.1]
Message-ID:  <19970713193138.DB37367@uriah.heep.sax.de>
In-Reply-To: <Pine.SOL.3.91.970713154846.16137B-100000@artemis>; from Robin Carey on Jul 13, 1997 15:55:17 %2B0100
References:  <Pine.GSO.3.96.970711105324.24237C-100000@james.freenet.hamilton.on.ca> <Pine.SOL.3.91.970713154846.16137B-100000@artemis>

next in thread | previous in thread | raw e-mail | index | archive | help
As Robin Carey wrote:

> > > 1) ispunct(3) doesn't work :) It returns TRUE for characters which are
> > >    not punctuation. To see what I mean, try this program:
> > 
> > Reading the manpage, the output of your demonstration program
> > looks about right...
> 
> Huh ?
> Doesn't work on my FreeBSD-2.2.1 system ....
> The ispunct(3) routine returns TRUE for characters which are not punctuation
> and not in the man page, on my computer anyway.

For me, it does return true for exactly those characters mentioned in
the man page (neglecting the fact that the man page didn't get the
backslash right):

j@uriah 157% cat foo.c
#include <stdio.h>
#include <ctype.h>

int
main(void)
{
        int c;

        for (c = 0; c < 128; c++)
                if (ispunct(c))
                        putchar(c);
        putchar('\n');
        return 0;
}
j@uriah 158% cc -O foo.c
j@uriah 159% ./a.out
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

Note that the man page talks about ASCII characters, ispunct(3) also
returns true for the punctuation characters of ISO Latin-1, if you
extend the range above to < 256.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



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