| www.delorie.com/gnu/docs/glibc/libc_121.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Some non GUI programs ask a yes-or-no question. If the messages (especially the questions) are translated into foreign languages, be sure that you localize the answers too. It would be very bad habit to ask a question in one language and request the answer in another, often English.
The GNU C library contains rpmatch to give applications easy
access to the corresponding locale definitions.
rpmatch checks the string in response whether
or not it is a correct yes-or-no answer and if yes, which one. The
check uses the YESEXPR and NOEXPR data in the
LC_MESSAGES category of the currently selected locale. The
return value is as follows:
1
0
-1
YESEXPR nor the NOEXPR
regular expression.
This function is not standardized but available beside in GNU libc at least also in the IBM AIX library.
This function would normally be used like this:
...
/* Use a safe default. */
_Bool doit = false;
fputs (gettext ("Do you really want to do this? "), stdout);
fflush (stdout);
/* Prepare the |
Note that the loop continues until an read error is detected or until a definitive (positive or negative) answer is read.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |