cvs commit: src/gnu/usr.bin/grep grep.1

Stefan Farfeleder stefanf at
Sun Oct 23 05:02:28 PDT 2005

On Sun, Oct 23, 2005 at 04:36:45AM -0700, Colin Percival wrote:
> Stefan Farfeleder wrote:
> >   Modified files:
> >     gnu/usr.bin/grep     grep.1 
> >   Log:
> >   Document [:blank:].
> The text now claims that [:alnum:], [:alpha:], [:blank:] ... [:space:] ...
> are self-explanatory names.  While I've managed to work out the difference
> between :blank: and :space: by looking at the source code (:blank: matches
> [ \t], while :space: matches [ \f\n\r\t\v] and possibly other characters
> depending upon the locale), I have trouble accepting that this difference
> is obvious from the names.
> Could you add some text explaining this difference?

Well, I think many of those aren't really self-explanatory (eg. [:cntrl:],
[:graph:], [:print:]) if you don't know the C library.  Here's a patch
that refers to ctype(3), though I'm not sure how to do that correctly
because grep(1) isn't in mdoc format.

-------------- next part --------------
Index: grep.1
RCS file: /home/ncvs/src/gnu/usr.bin/grep/grep.1,v
retrieving revision 1.27
diff -I.svn -u -r1.27 grep.1
--- grep.1	23 Oct 2005 11:19:56 -0000	1.27
+++ grep.1	23 Oct 2005 11:56:11 -0000
@@ -507,7 +507,7 @@
 Finally, certain named classes of characters are predefined within
 bracket expressions, as follows.
-Their names are self explanatory, and they are
+They are
 .BR [:alnum:] ,
 .BR [:alpha:] ,
 .BR [:blank:] ,
@@ -521,13 +521,10 @@
 .BR [:upper:] ,
 .BR [:xdigit:].
-For example,
-.B [[:alnum:]]
-.BR [0\-9A\-Za\-z] ,
-except the latter form depends upon the C locale and the
-\s-1ASCII\s0 character encoding, whereas the former is independent
-of locale and character set.
+Such a character class matches a character for which the corresponding
+ctype(3) function (prefixed with
+.BR is )
+returns a non-zero value.
 (Note that the brackets in these class names are part of the symbolic
 names, and must be included in addition to the brackets delimiting
 the bracket list.)  Most metacharacters lose their special meaning

More information about the cvs-src mailing list