.\" -*- coding: UTF-8 -*- .\" Copyright (C) 2006 Justin Pryzby .\" .\" %%%LICENSE_START(PERMISSIVE_MISC) .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be .\" included in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .\" %%%LICENSE_END .\" .\" References: .\" glibc manual and source .\" .\" 2006-05-19, mtk, various edits and example program .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH RPMATCH 3 "9 juin 2020" GNU "Manuel du programmeur Linux" .SH NOM rpmatch \- Déterminer si la réponse à une question est affirmative ou négative .SH SYNOPSIS .nf \fB#include \fP .PP \fBint rpmatch(const char *\fP\fIréponse\fP\fB);\fP .fi .PP .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7))\ : .RE .PP \fBrpmatch\fP(): Since glibc 2.19: _DEFAULT_SOURCE Glibc 2.19 and earlier: _SVID_SOURCE .SH DESCRIPTION \fBrpmatch\fP() gère une réponse d'un utilisateur à une question oui ou non, avec support pour l'internationalisation. .PP \fIréponse\fP doit être une chaîne de caractères, terminée par le caractère nul, contenant une réponse fournie par un utilisateur, peut\-être obtenue avec \fBfgets\fP(3) ou \fBgetline\fP(3). .PP La préférence de langue de l'utilisateur est prise en compte par les variables d'environnement \fBLANG\fP, \fBLC_MESSAGES\fP et \fBLC_ALL\fP si le programme a appelé \fBsetlocale\fP(3) pour effectuer leurs modifications. .PP Regardless of the locale, responses matching \fB\(ha[Yy]\fP are always accepted as affirmative, and those matching \fB\(ha[Nn]\fP are always accepted as negative. .SH "VALEUR RENVOYÉE" Après l'examen de \fIréponse\fP, \fBrpmatch\fP() renvoie 0 dans le cas d'une réponse négative («\ Non\ »), 1 dans le cas d'une réponse affirmative («\ Oui\ »), et \-1 si la valeur de \fIréponse\fP n'est pas reconnue. .SH ERREURS Une valeur de retour de \-1 indique soit une entrée invalide, soit une autre erreur. Il n'est pas correct de ne tester que la non nullité de la valeur de retour. .PP \fBrpmatch\fP() peut échouer pour les mêmes raisons que \fBregcomp\fP(3) ou \fBregexec\fP(3) échouerait\ ; la cause de l'erreur n'est pas disponible dans \fIerrno\fP ou ailleurs mais indique un échec du moteur d'expressions rationnelles (mais ce cas ne peut pas être distingué de celui d'une valeur de \fIréponse\fP non reconnue). .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lb lb lb l l l. Interface Attribut Valeur T{ \fBrpmatch\fP() T} Sécurité des threads MT\-Safe locale .TE .sp 1 .SH CONFORMITÉ .\" It is available on at least AIX 5.1 and FreeBSD 6.0. \fBrpmatch\fP() n'est requise par aucun standard mais est disponible sur quelques autres systèmes. .SH BOGUES The \fBrpmatch\fP() implementation looks at only the first character of \fIresponse\fP. As a consequence, "nyes" returns 0, and "ynever; not in a million years" returns 1. It would be preferable to accept input strings much more strictly, for example (using the extended regular expression notation described in \fBregex\fP(7)): \fB\(ha([yY]|yes|YES)$\fP and \fB\(ha([nN]|no|NO)$\fP. .SH EXEMPLES Le programme exemple suivant affiche les résultats lorsque \fBrpmatch\fP() est appliqué à la chaîne fournie comme argument de la ligne de commande du programme. .PP .EX #define _SVID_SOURCE #include #include #include #include int main(int argc, char *argv[]) { if (argc != 2 || strcmp(argv[1], "\-\-help") == 0) { fprintf(stderr, "%s réponse\en", argv[0]); exit(EXIT_FAILURE); } setlocale(LC_ALL, ""); printf("rpmatch() a renvoyé\ : %d\en", rpmatch(argv[1])); exit(EXIT_SUCCESS); } .EE .SH "VOIR AUSSI" \fBfgets\fP(3), \fBgetline\fP(3), \fBnl_langinfo\fP(3), \fBregcomp\fP(3), \fBsetlocale\fP(3) .SH COLOPHON Cette page fait partie de la publication\ 5.10 du projet \fIman\-pages\fP Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse \%https://www.kernel.org/doc/man\-pages/. .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier et David Prévot . Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .