Date: Mon, 13 Nov 2017 21:14:29 +0100 From: Polytropon <freebsd@edvax.de> To: byrnejb@harte-lyne.ca Cc: "James B. Byrne via freebsd-questions" <freebsd-questions@freebsd.org>, mfv@bway.net Subject: Re: Regex character and collation class documentation Message-ID: <20171113211429.bf4f1723.freebsd@edvax.de> In-Reply-To: <b0835f510ae66a82808725fa8ae8c7d0.squirrel@webmail.harte-lyne.ca> References: <mailman.90.1510315202.51235.freebsd-questions@freebsd.org> <68be33ca89aab31e068253dffe129021.squirrel@webmail.harte-lyne.ca> <20171111104543.11279fb7@gecko4> <b0835f510ae66a82808725fa8ae8c7d0.squirrel@webmail.harte-lyne.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 13 Nov 2017 09:09:52 -0500, James B. Byrne via freebsd-questions wrote:
> A file named cname.h does not even exist on my system. At least if it
> does then find does not report it.
Check the following ocation:
/usr/src/lib/libc/regex/cname.h
> On the other hand, this file:
>
> /usr/local/include/nstring.h
Due to the path, this file seems to be installed by a port.
You could check which one it was.
> contains this:
>
> /* The standard C library routines isdigit(), for some weird
> historical reason, does not take a character (type 'char') as its
> argument. Instead it takes an integer. When the integer is a whole
> number, it represents a character in the obvious way using the local
> character set encoding. When the integer is negative, the results
> are undefined.
>
> Passing a character to isdigit(), which expects an integer,
> results in isdigit() sometimes getting a negative number.
>
> On some systems, when the integer is negative, it represents exactly
> the character you want it to anyway (e.g. -1 is the character that
> is encoded 0xFF). But on others, it does not.
>
> (The same is true of other routines like isdigit()).
>
> Therefore, we have the substitutes for isdigit() etc. that take an
> actual character (type 'char') as an argument.
> */
>
> #define ISALNUM(C) (isalnum((unsigned char)(C)))
> #define ISALPHA(C) (isalpha((unsigned char)(C)))
> #define ISCNTRL(C) (iscntrl((unsigned char)(C)))
> #define ISDIGIT(C) (isdigit((unsigned char)(C)))
> #define ISGRAPH(C) (isgraph((unsigned char)(C)))
> #define ISLOWER(C) (islower((unsigned char)(C)))
> #define ISPRINT(C) (isprint((unsigned char)(C)))
> #define ISPUNCT(C) (ispunct((unsigned char)(C)))
> #define ISSPACE(C) (isspace((unsigned char)(C)))
> #define ISUPPER(C) (isupper((unsigned char)(C)))
> #define ISXDIGIT(C) (isxdigit((unsigned char)(C)))
> #define TOUPPER(C) ((char)toupper((unsigned char)(C)))
>
> But nowhere can I find 'isnul' or ISNUL'.
Yes, nothing in that file.
The only occurances of NUL I find are in the character-name table
in /usr/src/lib/libc/regex/cname.h:
/* character-name table */
static struct cname {
char *name;
char code;
} cnames[] = {
{"NUL", '\0'},
/* ... lots of lines omitted ... */
{NULL, 0}
};
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171113211429.bf4f1723.freebsd>
