OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man3 / getpwnam.3
index e4c957b..6b918c8 100644 (file)
 .\" Modified 2003-11-15 by aeb
 .\" 2008-11-07, mtk, Added an example program for getpwnam_r().
 .\"
-.\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
-.\"    all rights reserved.
-.\" Translated 1997-12-18, HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
-.\" Updated & Modified 2004-01-06, Yuichi SATO <ysato444@yahoo.co.jp>
-.\" Updated & Modified 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated & Modified 2005-10-08, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2008-12-24, Akihiro MOTOKI, LDP v3.14
+.\"*******************************************************************
 .\"
-.TH GETPWNAM 3  2009-03-30 "GNU" "Linux Programmer's Manual"
-.\"O .SH NAME
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH GETPWNAM 3 2010\-10\-21 GNU "Linux Programmer's Manual"
 .SH 名前
-.\"O getpwnam, getpwnam_r, getpwuid, getpwuid_r \- get password file entry
 getpwnam, getpwnam_r, getpwuid, getpwuid_r \- パスワードファイルのエントリの取得
-.\"O .SH SYNOPSIS
 .SH 書式
 .nf
-.B #include <sys/types.h>
-.B #include <pwd.h>
+\fB#include <sys/types.h>\fP
+\fB#include <pwd.h>\fP
 .sp
-.BI "struct passwd *getpwnam(const char *" name );
+\fBstruct passwd *getpwnam(const char *\fP\fIname\fP\fB);\fP
 .sp
-.BI "struct passwd *getpwuid(uid_t " uid );
+\fBstruct passwd *getpwuid(uid_t \fP\fIuid\fP\fB);\fP
 .sp
-.BI "int getpwnam_r(const char *" name ", struct passwd *" pwd ,
+\fBint getpwnam_r(const char *\fP\fIname\fP\fB, struct passwd *\fP\fIpwd\fP\fB,\fP
 .br
-.BI "            char *" buf ", size_t " buflen ", struct passwd **" result );
+\fB            char *\fP\fIbuf\fP\fB, size_t \fP\fIbuflen\fP\fB, struct passwd **\fP\fIresult\fP\fB);\fP
 .sp
-.BI "int getpwuid_r(uid_t " uid ", struct passwd *" pwd ,
+\fBint getpwuid_r(uid_t \fP\fIuid\fP\fB, struct passwd *\fP\fIpwd\fP\fB,\fP
 .br
-.BI "            char *" buf ", size_t " buflen ", struct passwd **" result );
+\fB            char *\fP\fIbuf\fP\fB, size_t \fP\fIbuflen\fP\fB, struct passwd **\fP\fIresult\fP\fB);\fP
 .fi
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc 向けの機能検査マクロの要件
-.RB ( feature_test_macros (7)
-参照):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .in
 .sp
 .ad l
-.BR getpwnam_r (),
-.BR getpwuid_r ():
+\fBgetpwnam_r\fP(), \fBgetpwuid_r\fP():
 .RS 4
-_POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _BSD_SOURCE ||
-_SVID_SOURCE || _POSIX_SOURCE
+_POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE
+|| _POSIX_SOURCE
 .RE
 .ad b
-.\"O .SH DESCRIPTION
 .SH 説明
-.\"O The
-.\"O .BR getpwnam ()
-.\"O function returns a pointer to a structure containing
-.\"O the broken-out fields of the record in the password database
-.\"O (e.g., the local password file
-.\"O .IR /etc/passwd ,
-.\"O NIS, and LDAP)
-.\"O that matches the username
-.\"O .IR name .
-.BR getpwnam ()
-関数は、ユーザ名
-.I name
-にマッチするパスワード・データベースのエントリを
-要素毎に分解し、各要素を格納した構造体へのポインタを返す
-(パスワード・データベースの例:
-ローカルのパスワードファイル
-.IR /etc/passwd ,
+\fBgetpwnam\fP()  関数は、ユーザ名 \fIname\fP にマッチするパスワード・データベースのエントリを
+要素毎に分解し、各要素を格納した構造体へのポインタを返す (パスワード・データベースの例: ローカルのパスワードファイル \fI/etc/passwd\fP,
 NIS, LDAP)。
 .PP
-.\"O The
-.\"O .BR getpwuid ()
-.\"O function returns a pointer to a structure containing
-.\"O the broken-out fields of the record in the password database
-.\"O that matches the user ID
-.\"O .IR uid .
-.BR getpwuid ()
-関数は、ユーザ ID
-.I uid
-にマッチするパスワード・データベースのエントリを
+\fBgetpwuid\fP()  関数は、ユーザ ID \fIuid\fP にマッチするパスワード・データベースのエントリを
 要素毎に分解し、各要素を格納した構造体へのポインタを返す。
 .PP
-.\"O The
-.\"O .BR getpwnam_r ()
-.\"O and
-.\"O .BR getpwuid_r ()
-.\"O functions obtain the same information, but store the retrieved
-.\"O .I passwd
-.\"O structure in the space pointed to by
-.\"O .IR pwd .
-.BR getpwnam_r ()
-と
-.BR getpwuid_r ()
-関数は (上記の関数と) 同じ情報を取得するが、
-取得した
-.I passwd
-構造体を
-.I pwd
-が指す領域に格納する。
-.\"O This
-.\"O .I passwd
-.\"O structure contains pointers to strings, and these strings
-.\"O are stored in the buffer
-.\"O .I buf
-.\"O of size
-.\"O .IR buflen .
-この
-.I passwd
-構造体には文字列へのポインタが含まれ、
-これらの文字列はサイズ
-.I buflen
-のバッファ
-.I buf
-に格納される。
-.\"O A pointer to the result (in case of success) or NULL (in case no entry
-.\"O was found or an error occurred) is stored in
-.\"O .IR *result .
-成功した場合
-.I *result
-には結果へのポインタが格納される。
-エントリが見つからなかった場合やエラーが発生した場合には
-.I *result
-には NULL が入る。
-.PP
-.\"O The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
 \fIpasswd\fP 構造体は、\fI<pwd.h>\fP で以下のように定義されている:
 .sp
 .in +4n
 .nf
 struct passwd {
-.\"O     char   *pw_name;       /* username */
-.\"O     char   *pw_passwd;     /* user password */
-.\"O     uid_t   pw_uid;        /* user ID */
-.\"O     gid_t   pw_gid;        /* group ID */
-.\"O     char   *pw_gecos;      /* real name */
-.\"O     char   *pw_dir;        /* home directory */
-.\"O     char   *pw_shell;      /* shell program */
     char   *pw_name;       /* ユーザ名 */
     char   *pw_passwd;     /* ユーザのパスワード */
     uid_t   pw_uid;        /* ユーザ ID */
     gid_t   pw_gid;        /* グループ ID */
-    char   *pw_gecos;      /* 実名 */
+    char   *pw_gecos;      /* ユーザ情報 */
     char   *pw_dir;        /* ホームディレクトリ */
     char   *pw_shell;      /* シェルプログラム */
 };
 .fi
 .in
 .PP
-.\"O The maximum needed size for
-.\"O .I buf
-.\"O can be found using
-.\"O .BR sysconf (3)
-.\"O with the argument
-.\"O .BR _SC_GETPW_R_SIZE_MAX .
-.I buf
-に最大必要なサイズは、
-.BR sysconf (3)
-に引き数
-.B _SC_GETPW_R_SIZE_MAX
-を指定して実行することで分かる。
-.\"O .SH "RETURN VALUE"
+これらのフィールドの詳しい情報については \fBpasswd\fP(5) を参照のこと。
+.PP
+\fBgetpwnam_r\fP() と \fBgetpwuid_r\fP() 関数は、それぞれ\fBgetpwnam\fP() と
+\fBgetpwuid\fP() と同じ情報を取得するが、取得した \fIpasswd\fP 構造体を
+\fIpwd\fP が指す領域に格納する。\fIpasswd\fP 構造体のメンバーが指す文字列は、
+サイズ \fIbuflen\fP のバッファ \fIbuf\fP に格納される。成功した場合
+\fI*result\fP には結果へのポインタが格納される。エントリが見つからなかった
+場合やエラーが発生した場合には \fI*result\fP には NULL が入る。
+.PP
+\fIbuf\fP に必要な最大サイズは、 \fBsysconf\fP(3) に引き数
+\fB_SC_GETPW_R_SIZE_MAX\fP を指定して実行することで分かる。
 .SH 返り値
-.\"O The
-.\"O .BR getpwnam ()
-.\"O and
-.\"O .BR getpwuid ()
-.\"O functions return a pointer to a
-.\"O .I passwd
-.\"O structure, or NULL if the matching entry is not found or
-.\"O an error occurs.
-.BR getpwnam ()
-と
-.BR getpwuid ()
-関数は、
-.I passwd
-構造体へのポインタを返す。
-一致するエントリが見つからなかった場合や、エラーが発生した場合は NULL を返す。
-.\"O If an error occurs,
-.\"O .I errno
-.\"O is set appropriately.
-.\"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
-をチェックしたい場合は、
-呼び出しの前に (この値を) 0 に設定しておくべきである。
+\fBgetpwnam\fP()  と \fBgetpwuid\fP()  関数は、 \fIpasswd\fP 構造体へのポインタを返す。
+一致するエントリが見つからなかった場合や、エラーが発生した場合は NULL を返す。 エラーが起こった場合、 \fIerrno\fP が適切に設定される。
+呼び出しの後で \fIerrno\fP をチェックしたい場合は、 呼び出しの前に (この値を) 0 に設定しておくべきである。
 .LP
-.\"O The return value may point to a static area, and may be overwritten
-.\"O by subsequent calls to
-.\"O .BR getpwent (3),
-.\"O .BR getpwnam (),
-.\"O or
-.\"O .BR getpwuid ().
-.\"O (Do not pass the returned pointer to
-.\"O .BR free (3).)
-返り値は静的な領域を指しており、その後の
-.BR getpwent (3),
-.BR getpwnam (),
-.BR getpwuid ()
-の呼び出しで上書きされるかもしれない。
-(返されたポインタを
-.BR free (3)
-に渡さないこと。)
+返り値は静的な領域を指しており、その後の \fBgetpwent\fP(3), \fBgetpwnam\fP(), \fBgetpwuid\fP()
+の呼び出しで上書きされるかもしれない。 (返されたポインタを \fBfree\fP(3)  に渡さないこと。)
 .LP
-.\"O On success,
-.\"O .BR getpwnam_r ()
-.\"O and
-.\"O .BR getpwuid_r ()
-.\"O return zero, and set
-.\"O .IR *result
-.\"O to
-.\"O .IR pwd .
-.\"O If no matching password record was found,
-.\"O these functions return 0 and store NULL in
-.\"O .IR *result .
-.\"O In case of error, an error number is returned, and NULL is stored in
-.\"O .IR *result .
-成功すると、
-.BR getpwnam_r ()
-と
-.BR getpwuid_r ()
-は 0 を返し、
-.I *result
-に
-.I pwd
-を設定する。
-マッチするパスワード・エントリが見つからなかった場合には、
-0 を返し、
-.I *result
-に NULL を設定する。
-エラーの場合、エラー番号を返し、
-.I *result
-に NULL を設定する。
-.\"O .SH ERRORS
+成功すると、 \fBgetpwnam_r\fP()  と \fBgetpwuid_r\fP()  は 0 を返し、 \fI*result\fP に \fIpwd\fP
+を設定する。 マッチするパスワード・エントリが見つからなかった場合には、 0 を返し、 \fI*result\fP に NULL を設定する。
+エラーの場合、エラー番号を返し、 \fI*result\fP に NULL を設定する。
 .SH エラー
-.TP
-.\"O .BR 0 " or " ENOENT " or " ESRCH " or " EBADF " or " EPERM " or ... "
-.BR 0 " または " ENOENT " または " ESRCH " または " EBADF " または " EPERM " または ... "
-.\"O The given
-.\"O .I name
-.\"O or
-.\"O .I uid
-.\"O was not found.
-指定された
-.I name
-または
-.I uid
-が見つからなかった。
-.TP
-.B EINTR
-.\"O A signal was caught.
-シグナルがキャッチされた。
-.TP
-.B EIO
-.\"O I/O error.
+.TP 
+\fB0\fP または \fBENOENT\fP または \fBESRCH\fP または \fBEBADF\fP または \fBEPERM\fP または ... 
+指定された \fIname\fP または \fIuid\fP が見つからなかった。
+.TP 
+\fBEINTR\fP
+シグナルが捕捉された。
+.TP 
+\fBEIO\fP
 I/O エラー。
-.TP
-.B EMFILE
-.\"O The maximum number
-.\"O .RB ( OPEN_MAX )
-.\"O of files was open already in the calling process.
-呼び出したプロセスにおいて、
-既に最大数 (OPEN_MAX) のファイルがオープンされている。
-.TP
-.B ENFILE
-.\"O The maximum number of files was open already in the system.
-システム上で既に最大数のファイルがオープンされている。
-.TP
-.B ENOMEM
+.TP 
+\fBEMFILE\fP
+呼び出し元プロセスがオープンしているファイル数が すでに上限 (\fBOPEN_MAX\fP)  であった。
+.TP 
+\fBENFILE\fP
+システムでオープンされているファイル数がすでに上限であった。
+.TP 
+\fBENOMEM\fP
 .\" not in POSIX
-.\"O Insufficient memory to allocate
-.\"O .I passwd
-.\"O structure.
-.\"O .\" This structure is static, allocated 0 or 1 times. No memory leak. (libc45)
-.\" POSIX にはない。
-.I passwd
-構造体を割り当てるためのメモリが不十分。
-.\" この構造体は静的であり、0 回または 1 回割り当てられる。
-.\" メモリリークは無い。(libc45)
-.TP
-.B ERANGE
-.\"O Insufficient buffer space supplied.
+.\" This structure is static, allocated 0 or 1 times. No memory leak. (libc45)
+\fIpasswd\fP 構造体に割り当てるメモリが十分なかった。
+.TP 
+\fBERANGE\fP
 与えられたバッファ空間が不十分である。
-.\"O .SH FILES
 .SH ファイル
-.TP
-.I /etc/passwd
-.\"O local password database file
+.TP 
+\fI/etc/passwd\fP
 ローカルのパスワード・データベースファイル
-.\"O .SH "CONFORMING TO"
 .SH 準拠
-SVr4, 4.3BSD, POSIX.1-2001.
-.\"O .SH NOTES
+SVr4, 4.3BSD, POSIX.1\-2001.  \fIpw_gecos\fP フィールドは POSIX では規定されていないが、
+ほとんどの実装に存在する。
 .SH 注意
-.\"O The formulation given above under "RETURN VALUE" is from POSIX.1-2001.
-上記の「返り値」以下の記述は POSIX.1-2001 に拠る。
-.\"O It does not call "not found" an error, and hence does not specify what value
-.\"O .I errno
-.\"O might have in this situation.
-.\"O But that makes it impossible to recognize
-.\"O errors.
-.\"O One might argue that according to POSIX
-.\"O .I errno
-.\"O should be left unchanged if an entry is not found.
-.\"O Experiments on various
-.\"O UNIX-like systems show that lots of different values occur in this
-.\"O situation: 0, ENOENT, EBADF, ESRCH, EWOULDBLOCK, EPERM and probably others.
-この標準は「(エントリが) 見つからないこと」をエラーとしていないので、
-そのような場合に
-.I errno
-がどのような値になるかを定めていない。
-そのため、エラーを認識することは不可能である。
-POSIX に準拠して、エントリが見つからない場合は
-.I errno
-を変更しないようにすべきである、と主張する人もいるかもしれない。
-様々な UNIX 系のシステムで試してみると、そのような場合には
-0, ENOENT, EBADF, ESRCH, EWOULDBLOCK, EPERM といった様々な値が返される。
-他の値が返されるかもしれない。
-.\"O .\" more precisely:
-.\"O .\" AIX 5.1 - gives ESRCH
-.\"O .\" OSF1 4.0g - gives EWOULDBLOCK
-.\"O .\" libc, glibc up to version 2.6, Irix 6.5 - give ENOENT
-.\"O .\" glibc since version 2.7 - give 0
-.\"O .\" FreeBSD 4.8, OpenBSD 3.2, NetBSD 1.6 - give EPERM
-.\"O .\" SunOS 5.8 - gives EBADF
-.\"O .\" Tru64 5.1b, HP-UX-11i, SunOS 5.7 - give 0
-.\" より正確には:
-.\" AIX 5.1 は ESRCH を返す。
-.\" OSF1 4.0g は EWOULDBLOCK を返す。
-.\" libc, glibc (バージョン 2.6 まで), Irix 6.5 は ENOENT を返す。
-.\" glibc (バージョン 2.7 以降) は 0 を返す。
-.\" FreeBSD 4.8, OpenBSD 3.2, NetBSD 1.6 は EPERM を返す。
-.\" SunOS 5.8 は EBADF を返す。
-.\" Tru64 5.1b, HP-UX-11i, SunOS 5.7 は 0 を返す。
+.\" more precisely:
+.\" AIX 5.1 - gives ESRCH
+.\" OSF1 4.0g - gives EWOULDBLOCK
+.\" libc, glibc up to version 2.6, Irix 6.5 - give ENOENT
+.\" glibc since version 2.7 - give 0
+.\" FreeBSD 4.8, OpenBSD 3.2, NetBSD 1.6 - give EPERM
+.\" SunOS 5.8 - gives EBADF
+.\" Tru64 5.1b, HP-UX-11i, SunOS 5.7 - give 0
+上記の「返り値」以下の記述は POSIX.1\-2001 に拠る。 この標準は「(エントリが) 見つからないこと」をエラーとしていないので、
+そのような場合に \fIerrno\fP がどのような値になるかを定めていない。 そのため、エラーを認識することは不可能である。 POSIX
+に準拠して、エントリが見つからない場合は \fIerrno\fP を変更しないようにすべきである、と主張する人もいるかもしれない。 様々な UNIX
+系のシステムで試してみると、そのような場合には 0, ENOENT, EBADF, ESRCH, EWOULDBLOCK, EPERM
+といった様々な値が返される。 他の値が返されるかもしれない。
 
-.\"O The
-.\"O .I pw_dir
-.\"O field contains the name of the initial working directory of the user.
-フィールド
-.I pw_dir
-には、ユーザの作業ディレクトリ名の初期値が格納される。
-.\"O Login programs use the value of this field to initialize the
-.\"O .B HOME
-.\"O environment variable for the login shell.
-.\"O An application that wants to determine its user's home directory
-.\"O should inspect the value of
-.\"O .B HOME
-.\"O (rather than the value
-.\"O .IR getpwuid(getuid())\->pw_dir )
-.\"O since this allows the user to modify their notion of
-.\"O "the home directory" during a login session.
-.\"O To determine the (initial) home directory of another user,
-.\"O it is necessary to use
-.\"O .I getpwnam("username")\->pw_dir
-.\"O or similar.
-ログインプロセスは、このフィールドの値を使って、
-ログインシェルの
-.B HOME
-環境変数を初期化する。
-アプリケーションが、ユーザのホーム・ディレクトリを決定する場合には、
-.RI ( getpwuid(getuid())\->pw_dir
-の値ではなく)
-.B HOME
-の値を検査するようにすべきである。
-なぜなら、このようにすることで、ユーザがログイン・セッション中で
-「ホーム・ディレクトリ」の意味を変更できるようになるからである。
-別のユーザのホーム・ディレクトリ (の初期値) を知るには
-.I getpwnam("username")\->pw_dir
+フィールド \fIpw_dir\fP には、ユーザの作業ディレクトリ名の初期値が格納される。 ログインプロセスは、このフィールドの値を使って、
+ログインシェルの \fBHOME\fP 環境変数を初期化する。 アプリケーションが、ユーザのホーム・ディレクトリを決定する場合には、
+(\fIgetpwuid(getuid())\->pw_dir\fP の値ではなく)  \fBHOME\fP の値を検査するようにすべきである。
+なぜなら、このようにすることで、ユーザがログイン・セッション中で 「ホーム・ディレクトリ」の意味を変更できるようになるからである。
+別のユーザのホーム・ディレクトリ (の初期値) を知るには \fIgetpwnam("username")\->pw_dir\fP
 か同様の方法を使う必要がある。
-.\"O .SH EXAMPLE
 .SH 例
-.\"O The program below demonstrates the use of
-.\"O .BR getpwnam_r ()
-.\"O to find the full username and user ID for the username
-.\"O supplied as a command-line argument.
-以下のプログラムは
-.BR getpwnam_r ()
-の使用例を示したもので、コマンドライン引き数で渡されたユーザ名に対する
-完全なユーザ名とユーザ ID を探すものである。
+以下のプログラムは \fBgetpwnam_r\fP()  の使用例を示したもので、コマンドライン引き数で渡されたユーザ名に対する 完全なユーザ名とユーザ
+ID を探すものである。
 
 .nf
 #include <pwd.h>
@@ -432,13 +188,11 @@ main(int argc, char *argv[])
     int s;
 
     if (argc != 2) {
-        fprintf(stderr, "Usage: %s username\\n", argv[0]);
+        fprintf(stderr, "Usage: %s username\en", argv[0]);
         exit(EXIT_FAILURE);
     }
 
     bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
-.\"O     if (bufsize == \-1)          /* Value was indeterminate */
-.\"O         bufsize = 16384;        /* Should be more than enough */
     if (bufsize == \-1)          /* 値を決定できなかった */
         bufsize = 16384;        /* 十分大きな値にすべき */
 
@@ -451,7 +205,7 @@ main(int argc, char *argv[])
     s = getpwnam_r(argv[1], &pwd, buf, bufsize, &result);
     if (result == NULL) {
         if (s == 0)
-            printf("Not found\\n");
+            printf("Not found\en");
         else {
             errno = s;
             perror("getpwnam_r");
@@ -459,18 +213,10 @@ main(int argc, char *argv[])
         exit(EXIT_FAILURE);
     }
 
-    printf("Name: %s; UID: %ld\\n", pwd.pw_gecos, (long) pwd.pw_uid);
+    printf("Name: %s; UID: %ld\en", pwd.pw_gecos, (long) pwd.pw_uid);
     exit(EXIT_SUCCESS);
 }
 .fi
-.\"O .SH "SEE ALSO"
 .SH 関連項目
-.BR endpwent (3),
-.BR fgetpwent (3),
-.BR getgrnam (3),
-.BR getpw (3),
-.BR getpwent (3),
-.BR getspnam (3),
-.BR putpwent (3),
-.BR setpwent (3),
-.BR passwd (5)
+\fBendpwent\fP(3), \fBfgetpwent\fP(3), \fBgetgrnam\fP(3), \fBgetpw\fP(3),
+\fBgetpwent\fP(3), \fBgetspnam\fP(3), \fBputpwent\fP(3), \fBsetpwent\fP(3), \fBpasswd\fP(5)