.\" -*- coding: UTF-8 -*- .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH GETPWENT_R 3 "15 septembre 2017" GNU "Manuel du programmeur Linux" .SH NOM getpwent_r, fgetpwent_r \- Obtenir un enregistrement du fichier passwd de manière réentrante .SH SYNOPSIS .nf \fB#include \fP .PP \fBint getpwent_r(struct passwd *\fP\fIpwbuf\fP\fB, char *\fP\fIbuf\fP\fB,\fP \fB size_t \fP\fIbuflen\fP\fB, struct passwd **\fP\fIpwbufp\fP\fB);\fP .PP \fBint fgetpwent_r(FILE *\fP\fIstream\fP\fB, struct passwd *\fP\fIpwbuf\fP\fB, char *\fP\fIbuf\fP\fB,\fP \fB size_t \fP\fIbuflen\fP\fB, struct passwd **\fP\fIpwbufp\fP\fB);\fP .fi .PP .in -4n Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7))\ : .in .PP \fBgetpwent_r\fP(), Since glibc 2.19: _DEFAULT_SOURCE Glibc 2.19 and earlier: _BSD_SOURCE || _SVID_SOURCE .br \fBfgetpwent_r\fP(): Since glibc 2.19: _DEFAULT_SOURCE Glibc 2.19 and earlier: _SVID_SOURCE .SH DESCRIPTION The functions \fBgetpwent_r\fP() and \fBfgetpwent_r\fP() are the reentrant versions of \fBgetpwent\fP(3) and \fBfgetpwent\fP(3). The former reads the next passwd entry from the stream initialized by \fBsetpwent\fP(3). The latter reads the next passwd entry from \fIstream\fP. .PP La structure \fIpasswd\fP est définie dans \fI\fP comme ceci\ : .PP .in +4n .EX struct passwd { char *pw_name; /* Nom d'utilisateur */ char *pw_passwd; /* Mot de passe de l'utilisateur */ uid_t pw_uid; /* ID de l'utilisateur */ gid_t pw_gid; /* ID du groupe */ char *pw_gecos; /* Information utilisateur */ char *pw_dir; /* Répertoire personnel */ char *pw_shell; /* Interpréteur de commande */ }; .EE .in .PP Pour plus d'informations à propos des champs de cette structure, consultez \fBpasswd\fP(5). .PP Les fonctions non réentrantes renvoient un pointeur sur une zone statique, zone qui contient d'autres pointeurs vers le nom, le mot de passe, le champ gecos, le répertoire personnel et le shell de l'utilisateur. Les fonctions réentrantes décrites ici renvoient tout ceci dans des tampons fournis par l'appelant. Il y a tout d'abord le tampon \fIpwbuf\fP qui contient une structure \fIpasswd\fP. Puis le tampon \fIbuf\fP de taille \fIbuflen\fP qui contient les chaînes supplémentaires. Le résultat de ces fonctions, la structure \fIpasswd\fP lue dans le flux, est enregistré dans le tampon \fI*pwbuf\fP fourni, et un pointeur vers cette structure \fIpasswd\fP est renvoyé dans \fI*pwbufp\fP. .SH "VALEUR RENVOYÉE" Si elles réussissent, ces fonctions renvoient 0 et \fI*pwbufp\fP est un pointeur vers la structure \fIpasswd\fP. Si elles échouent, ces fonctions renvoient une valeur d'erreur et \fI*pwbufp\fP est NULL. .SH ERREURS .TP \fBENOENT\fP Plus d'entrées. .TP \fBERANGE\fP L'espace tampon fourni est insuffisant. Veuillez essayer à nouveau avec un tampon plus grand. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lb lb lbw27 l l l. Interface Attribut Valeur T{ \fBgetpwent_r\fP() T} Sécurité des threads MT\-Unsafe race:pwent locale T{ \fBfgetpwent_r\fP() T} Sécurité des threads MT\-Safe .TE .sp 1 In the above table, \fIpwent\fP in \fIrace:pwent\fP signifies that if any of the functions \fBsetpwent\fP(), \fBgetpwent\fP(), \fBendpwent\fP(), or \fBgetpwent_r\fP() are used in parallel in different threads of a program, then data races could occur. .SH CONFORMITÉ These functions are GNU extensions, done in a style resembling the POSIX version of functions like \fBgetpwnam_r\fP(3). Other systems use the prototype .PP .in +4n .EX struct passwd * getpwent_r(struct passwd *pwd, char *buf, int buflen); .EE .in .PP ou mieux, .PP .in +4n .EX int getpwent_r(struct passwd *pwd, char *buf, int buflen, FILE **pw_fp); .EE .in .SH NOTES La fonction \fBgetpwent_r\fP() n'est pas vraiment réentrante puisqu'elle partage la position de lecture dans le flux avec tous les autres threads. .SH EXEMPLE .EX #define _GNU_SOURCE #include #include #define BUFLEN 4096 int main(void) { struct passwd pw, *pwp; char buf[BUFLEN]; int i; setpwent(); while (1) { i = getpwent_r(&pw, buf, BUFLEN, &pwp); if (i) break; printf("%s (%d)\etHOME %s\etSHELL %s\en", pwp\->pw_name, pwp\->pw_uid, pwp\->pw_dir, pwp\->pw_shell); } endpwent(); exit(EXIT_SUCCESS); } .EE .\" perhaps add error checking - should use strerror_r .\" #include .\" #include .\" if (i) { .\" if (i == ENOENT) .\" break; .\" printf("getpwent_r: %s", strerror(i)); .\" exit(EXIT_SUCCESS); .\" } .SH "VOIR AUSSI" \fBfgetpwent\fP(3), \fBgetpw\fP(3), \fBgetpwent\fP(3), \fBgetpwnam\fP(3), \fBgetpwuid\fP(3), \fBputpwent\fP(3), \fBpasswd\fP(5) .SH COLOPHON Cette page fait partie de la publication\ 5.04 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 .