From owner-freebsd-questions@freebsd.org Mon Nov 13 20:14:39 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C27D3DD47C5 for ; Mon, 13 Nov 2017 20:14:39 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mailrelay13.qsc.de (mailrelay13.qsc.de [212.99.187.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.antispameurope.com", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F33E7C5D8 for ; Mon, 13 Nov 2017 20:14:38 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de ([213.148.129.14]) by mailrelay13.qsc.de; Mon, 13 Nov 2017 21:14:30 +0100 Received: from r56.edvax.de (port-92-195-23-159.dynamic.qsc.de [92.195.23.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id D79FE3CBF9; Mon, 13 Nov 2017 21:14:29 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id vADKETwG002078; Mon, 13 Nov 2017 21:14:29 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Mon, 13 Nov 2017 21:14:29 +0100 From: Polytropon To: byrnejb@harte-lyne.ca Cc: "James B. Byrne via freebsd-questions" , mfv@bway.net Subject: Re: Regex character and collation class documentation Message-Id: <20171113211429.bf4f1723.freebsd@edvax.de> In-Reply-To: References: <68be33ca89aab31e068253dffe129021.squirrel@webmail.harte-lyne.ca> <20171111104543.11279fb7@gecko4> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-cloud-security-sender: freebsd@edvax.de X-cloud-security-recipient: freebsd-questions@freebsd.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mailrelay13.qsc.de with 4A0DA683617 X-cloud-security-connect: mx01.qsc.de[213.148.129.14], TLS=1, IP=213.148.129.14 X-cloud-security: scantime:.1515 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Nov 2017 20:14:39 -0000 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, ...