.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sat Jul 24 19:29:54 1993 by Rik Faith (faith@cs.unc.edu) .\" .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka .\" all rights reserved. .\" Translated 1997-12-19, HIROFUMI Nishizuka .\" Updated & Modified 2004-05-30, Yuichi SATO .\" Updated & Modified 2005-09-06, Akihiro MOTOKI .\" .TH GETGRENT 3 2010-10-21 "" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O getgrent, setgrent, endgrent \- get group file entry getgrent, setgrent, endgrent \- グループファイルエントリの取得 .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .B #include .sp .B struct group *getgrent(void); .sp .B void setgrent(void); .sp .B void endgrent(void); .fi .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .PD 0 .ad l .BR setgrent (): .RS 4 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || .br /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L .RE .sp .BR getgrent (), .BR endgrent (): .RS 4 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .RE .PD .ad b .\"O .SH DESCRIPTION .SH 説明 .\"O The .\"O .BR getgrent () .\"O function returns a pointer to a structure containing .\"O the broken-out fields of a record in the group database .\"O (e.g., the local group file .\"O .IR /etc/group , .\"O NIS, and LDAP). .\"O The first time .\"O .BR getgrent () .\"O is called, .\"O it returns the first entry; thereafter, it returns successive entries. .BR getgrent () 関数は、グループ・データベースから取得したエントリを 要素毎に分解し、各要素を格納した構造体へのポインタを返す (グループ・データベースの例: ローカルのグループファイル .IR /etc/group , NIS, LDAP)。 .BR getgrent () は、最初に呼び出された時は最初のエントリを返し、 それ以降は呼び出される毎に次のエントリを返す。 .PP .\"O The .\"O .BR setgrent () .\"O function rewinds to the beginning .\"O of the group database, to allow repeated scans. .BR setgrent () 関数を使うと、もう一度読み込めるように、 グループ・データベースの先頭に戻る。 .PP .\"O The .\"O .BR endgrent () .\"O function is used to close the group database .\"O after all processing has been performed. .BR endgrent () 関数は、全ての処理が終わった後にグループ・ データベースをクローズする。 .PP .\"O The \fIgroup\fP structure is defined in \fI\fP as follows: \fIgroup\fP 構造体は、\fI\fP で以下のように定義されている: .sp .in +4n .nf struct group { .\"O char *gr_name; /* group name */ .\"O char *gr_passwd; /* group password */ .\"O gid_t gr_gid; /* group ID */ .\"O char **gr_mem; /* group members */ char *gr_name; /* グループ名 */ char *gr_passwd; /* グループのパスワード */ gid_t gr_gid; /* グループ ID */ char **gr_mem; /* グループのメンバ */ }; .fi .in .PP .\"O For more information about the fields of this structure, see .\"O .BR group (5). この構造体のフィールドの詳細は .BR group (5) を参照のこと。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O The .\"O .BR getgrent () .\"O function returns a pointer to a .\"O .I group .\"O structure, .\"O or NULL if there are no more entries or an error occurs. .BR getgrent () 関数は .I group 構造体へのポインタを返す。 これ以上エントリが無いか、エラーが発生した場合は NULL を返す。 .LP .\"O Upon error, .\"O .I errno .\"O may be set. .\"O If one wants to check .\"O .I errno .\"O after the call, it should be set to zero before the call. エラーが発生すると、 .I errno が適切に設定される。 この関数の呼び出し後に .I errno をチェックしたい場合は、呼び出し前に .I errno を 0 に設定しておかないといけない。 .\"O The return value may point to a static area, and may be overwritten .\"O by subsequent calls to .\"O .BR getgrent (), .\"O .BR getgrgid (3), .\"O or .\"O .BR getgrnam (3). .\"O (Do not pass the returned pointer to .\"O .BR free (3).) 返り値は静的な領域を指しており、その後の .BR getgrent (), .BR getgrgid (3), .BR getgrnam (3) の呼び出しで上書きされるかもしれない。 (返されたポインタを .BR free (3) に渡さないこと。) .\"O .SH ERRORS .SH エラー .TP .B EINTR .\"O A signal was caught. シグナルがキャッチされた。 .TP .B EIO .\"O I/O error. I/O エラー。 .TP .B EMFILE .\"O The calling process already has too many open files. 呼び出したプロセスが既にファイルをオープンし過ぎている。 .TP .B ENFILE .\"O Too many open files in the system. システム上にオープンされたファイルが多過ぎる。 .TP .B ENOMEM .\"O .\" not in POSIX .\"O Insufficient memory to allocate .\"O .I group .\"O structure. .\" POSIX にはない。 .I group 構造体を割り当てるためのメモリが不十分。 .TP .B ERANGE .\"O Insufficient buffer space supplied. 十分なバッファ空間がない。 .SH ファイル .TP .I /etc/group .\"O local group database file ローカルのグループ・データベースファイル .\"O .SH "CONFORMING TO" .SH 準拠 SVr4, 4.3BSD, POSIX.1-2001. .\"O .SH "SEE ALSO" .SH 関連項目 .BR fgetgrent (3), .BR getgrent_r (3), .BR getgrgid (3), .BR getgrnam (3) .BR getgrouplist (3), .BR putgrent (3), .BR group (5)