On Tue, May 09, 2006 at 10:17:23AM -0400, pryzbyj wrote:
> On Tue, May 09, 2006 at 02:40:52AM +0200, Michael Kerrisk wrote:

> > Any suggestions about other pages whose SEE ALSO should mention this
> > page?
> Not really ... I'll have to think about it.
I'm including patches to add a SEE ALSO, and also to fix and tweak the
page based on some new\-found understanding ..

If you tell me where to get your most recent copy, then I'll provide a
patch against that.

Justin

--- -   2006-05-17 16:39:22.208205000 -0400
+++ /tmp/setlocale3.gz.2087     2006-05-17 16:39:22.000000000 -0400
@@ -186,5 +186,6 @@
 .BR nl_langinfo (3),
 .BR strcoll (3),
 .BR strftime (3),
+.BR rpmatch (3),
 .BR charsets (4),
 .BR locale (7)

--- rpmatch.3   2006-05-05 17:55:55.000000000 -0400
+++ new/rpmatch.3       2006-05-17 20:55:14.000000000 -0400
@@ -21,7 +21,7 @@
 .\"
 .\" References:
 .\"   glibc manual and source
-.TH ERROR 3 "2006-05-05" GNU
+.TH RPMATCH 3 "2006-05-17" GNU
 .SH NAME
 rpmatch \- parse the response to a boolean question
 .SH SYNOPSIS
@@ -32,21 +32,25 @@
 \fBint rpmatch (const char *\fIresponse\fB);
 .SH DESCRIPTION
 \fBrpmatch\fP() handles a user response to yes or no questions, with
-support for internationalization.  The user's language preferrence is
-taken into account per the values of  \fBLANG\fP, \fBLC_MESSAGES\fP,
-and \fBLC_ALL\fP.
+support for internationalization.
 
-\fIresponse\fP should be a \fBNULL\fP-terminated string containing a
-user-supplied response, perhaps obtained with \fBfgets\fP(3) or
+\fIresponse\fP should be a null\-terminated string containing a
+user\-supplied response, perhaps obtained with \fBfgets\fP(3) or
 \fBgetline\fP(3).
+
+The user's language preference is taken into account per the
+environment variables \fBLANG\fP, \fBLC_MESSAGES\fP, and \fBLC_ALL\fP
+if the program has called \fBsetlocale\fP() to effect their changes.
 .SH "RETURN VALUE"
-\fBrpmatch\fP() returns 0 for a recognized negative response ("no"), 1
-for a recognized positive response ("yes"), and \-1 when the contents
+\fBrpmatch\fP() returns 0 for a recognized negative response (\*(lqno\*(rq), 1
+for a recognized positive response (\*(lqyes\*(rq), and \-1 when the contents
 of \fIresponse\fP is unrecognized.
 .SH ERRORS
 A return value of \-1 may indicate either an invalid input, or some
 other error.  It is incorrect to only test if the return value is
-nonzero.  \fBrpmatch\fP() can fail for any of the reasons that
+nonzero.
+
+\fBrpmatch\fP() can fail for any of the reasons that
 \fBregcomp\fP(3) or \fBregexec\fP(3) can fail; the cause of the error
 is not available from \fIerrno\fP or anywhere else, but indicates a
 failure of the regex engine (but this case is indistinguishable from
@@ -55,9 +59,15 @@
 \fBrpmatch\fP() is not required by any standards document, and should
 not be used in programs intended to be portable.
 .SH BUGS
-The \fBrpmatch\fP() implementation looks at only the first character
-of \fIresponse\fP.  As a consequence, "nyes" returns 0, and the
-following all return 1:
+\fBrpmatch\fP() is implemented with \fBregex\fP(), using the
+locale\-specific regular expressions \fBYESEXPR\fP and \fBNOEXPR\fP;
+only the first character of \fIresponse\fP is considered significant.
+Responses matching \fBm/^[Yy]/i\fP are always accepted as affirmative
+(in any locale), and those matching
+\fBm/^[Nn]/i\fP are always accepted as negative.
+
+\*(lqnyes\*(rq returns 0, and the following
+all return 1:
 .RS
 .sp
 \*(lqyno, never; not in a million years\*(rq
@@ -69,10 +79,10 @@
 \*(lqywhenever hell freezes over\*(rq
 .sp
 .RE
-It would be preferrable to accept parse input strings much more
+It would be preferable to parse input strings much more
 strictly, for example: \fBm/^y(es?)$/i\fP and \fBm/^n(o?)$/i\fP.
 .SH SEE ALSO
-.br
+.BR setlocale (3),
 .BR regex (3),
 .BR fgets (3),
 .BR getline (3)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to