OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man3 / getlogin.3
index e416c1b..ef5152c 100644 (file)
 .\" Changed Tue Sep 19 01:49:29 1995, aeb: moved from man2 to man3
 .\"  added ref to /etc/utmp, added BUGS section, etc.
 .\" modified 2003 Walter Harms, aeb - added getlogin_r, note on stdin use
+.\"*******************************************************************
 .\"
-.\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
-.\" Translated 1998-03-01, NAKANO Takeo <nakano@apm.seikei.ac.jp>
-.\" Updated & Modified 1999-08-21, NAKANO Takeo <nakano@apm.seikei.ac.jp>
-.\" Updated & Modified 2005-03-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
+.\" This file was generated with po4a. Translate the source file.
 .\"
-.TH GETLOGIN 3 2008-06-29 "GNU" "Linux Programmer's Manual"
-.\"O .SH NAME
-.\"O getlogin, getlogin_r, cuserid \- get username
+.\"*******************************************************************
+.TH GETLOGIN 3 2008\-06\-29 GNU "Linux Programmer's Manual"
 .SH 名前
 getlogin, getlogin_r, cuserid \- ユーザー名を取得する
-.\"O .SH SYNOPSIS
 .SH 書式
-.B #include <unistd.h>
+\fB#include <unistd.h>\fP
 .sp
-.B "char *getlogin(void);"
+\fBchar *getlogin(void);\fP
 .br
-.BI "int getlogin_r(char *" buf ", size_t " bufsize );
+\fBint getlogin_r(char *\fP\fIbuf\fP\fB, size_t \fP\fIbufsize\fP\fB);\fP
 .sp
-.B #include <stdio.h>
+\fB#include <stdio.h>\fP
 .sp
-.BI "char *cuserid(char *" string );
+\fBchar *cuserid(char *\fP\fIstring\fP\fB);\fP
 .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
-.BR getlogin_r ():
-_REENTRANT || _POSIX_C_SOURCE\ >=\ 199506L
+\fBgetlogin_r\fP(): _REENTRANT || _POSIX_C_SOURCE\ >=\ 199506L
 .br
-.BR cuserid ():
-_XOPEN_SOURCE
-.\"O .SH DESCRIPTION
+\fBcuserid\fP(): _XOPEN_SOURCE
 .SH 説明
-.\"O .BR getlogin ()
-.\"O returns a pointer to a string containing the name of
-.\"O the user logged in on the controlling terminal of the process, or a
-.\"O NULL pointer if this information cannot be determined.
-.\"O The string is
-.\"O statically allocated and might be overwritten on subsequent calls to
-.\"O this function or to
-.\"O .BR cuserid ().
-.BR getlogin ()
-は、現在のプロセスの制御端末にログインしているユーザー名の文字列への
-ポインタを返す。ユーザー名が決定できない場合は NULL ポインタを返す。
-文字列は静的領域に割り当てられており、この後でこの関数や
-.BR cuserid ()
+\fBgetlogin\fP()  は、現在のプロセスの制御端末にログインしているユーザー名の文字列への ポインタを返す。ユーザー名が決定できない場合は
+NULL ポインタを返す。 文字列は静的領域に割り当てられており、この後でこの関数や \fBcuserid\fP()
 が呼び出された際に上書きされることがある。
 .PP
-.\"O .BR getlogin_r ()
-.\"O returns this same username in the array
-.\"O .I buf
-.\"O of size
-.\"O .IR bufsize .
-.BR getlogin_r ()
-は、上記の同じユーザ名を、大きさ
-.I bufsize
-の配列
-.I buf
-に入れて返す。
+\fBgetlogin_r\fP()  は、上記の同じユーザ名を、大きさ \fIbufsize\fP の配列 \fIbuf\fP に入れて返す。
 .PP
-.\"O .BR cuserid ()
-.\"O returns a pointer to a string containing a username
-.\"O associated with the effective user ID of the process.
-.\"O If \fIstring\fP
-.\"O is not a NULL pointer, it should be an array that can hold at least
-.\"O \fBL_cuserid\fP characters; the string is returned in this array.
-.\"O Otherwise, a pointer to a string in a static area is returned.
-.\"O This
-.\"O string is statically allocated and might be overwritten on subsequent
-.\"O calls to this function or to
-.\"O .BR getlogin ().
-.BR cuserid ()
-は、現在のプロセスの実効ユーザーID に対応するユーザー名の
-文字列へのポインタを返す。
-\fIstring\fP が NULL ポインタ以外の場合、\fIstring\fP は少なくとも
-\fBL_cuserid\fP 文字を保持できる配列でなければならない。
-\fIstring\fP が NULL ポインタの場合には、静的領域に置かれた文字列への
-ポインタが返される。この文字列は静的領域に割り当てられており、後で
-この関数や
-.BR getlogin ()
-が呼び出された際に上書きされることがある。
+\fBcuserid\fP()  は、現在のプロセスの実効ユーザーID に対応するユーザー名の 文字列へのポインタを返す。 \fIstring\fP が NULL
+ポインタ以外の場合、\fIstring\fP は少なくとも \fBL_cuserid\fP 文字を保持できる配列でなければならない。 \fIstring\fP が
+NULL ポインタの場合には、静的領域に置かれた文字列への ポインタが返される。この文字列は静的領域に割り当てられており、後で この関数や
+\fBgetlogin\fP()  が呼び出された際に上書きされることがある。
 .PP
-.\"O The macro \fBL_cuserid\fP is an integer constant that indicates how
-.\"O long an array you might need to store a username.  \fBL_cuserid\fP is
-.\"O declared in \fBstdio.h\fP.
-マクロ \fBL_cuserid\fP は integer の定数で、ユーザー名を保持するために
-必要な配列の長さを示す。 \fBL_cuserid\fP は \fBstdio.h\fP で宣言されて
-いる。
+マクロ \fBL_cuserid\fP は integer の定数で、ユーザー名を保持するために 必要な配列の長さを示す。 \fBL_cuserid\fP は
+\fBstdio.h\fP で宣言されて いる。
 .PP
-.\"O These functions let your program identify positively the user who is
-.\"O running
-.\"O .RB ( cuserid ())
-.\"O or the user who logged in this session
-.\"O .RB ( getlogin ()).
-.\"O (These can differ when set-user-ID programs are
-.\"O involved.)
-これらの関数を使うと、プログラムを実行しているユーザー
-.RB ( cuserid ())
-や
-このセッションにログインしているユーザー
-.RB ( getlogin ())
-を明確に特定することができる
-(ただし set-user-ID プログラムでは、状況が違うこともある)。
+これらの関数を使うと、プログラムを実行しているユーザー (\fBcuserid\fP())  や このセッションにログインしているユーザー
+(\fBgetlogin\fP())  を明確に特定することができる (ただし set\-user\-ID プログラムでは、状況が違うこともある)。
 .PP
-.\"O For most purposes, it is more useful to use the environment variable
-.\"O \fBLOGNAME\fP to find out who the user is.
-.\"O This is more flexible
-.\"O precisely because the user can set \fBLOGNAME\fP arbitrarily.
-たいていの目的では、ユーザーの特定には環境変数 \fBLOGNAME\fP を調べ
-るほうが便利である。LOGNAME 変数はユーザーが自由に設定できるので
+たいていの目的では、ユーザーの特定には環境変数 \fBLOGNAME\fP を調べ るほうが便利である。LOGNAME 変数はユーザーが自由に設定できるので
 より柔軟な対応が可能になる。
-.\"O .SH "RETURN VALUE"
 .SH 返り値
-.\"O .BR getlogin ()
-.\"O returns a pointer to the username when successful,
-.\"O and NULL on failure.
-.\"O .BR getlogin_r ()
-.\"O returns 0 when successful, and nonzero on failure.
-.BR getlogin ()
-は成功した場合はユーザ名へのポインタを返し、失敗した場合は NULL を返す。
-.BR getlogin_r ()
+\fBgetlogin\fP()  は成功した場合はユーザ名へのポインタを返し、失敗した場合は NULL を返す。 \fBgetlogin_r\fP()
 は成功すると 0 を返し、失敗すると 0 以外を返す。
-.\"O .SH ERRORS
 .SH エラー
-.\"O POSIX specifies
 POSIX では以下のエラーが規定されている:
-.TP
-.B EMFILE
-.\"O The calling process already has the maximum allowed number of open files.
-呼び出し元プロセスがオープンしているファイル数がすでにプロセスあたりの
-上限に達している。
-.TP
-.B ENFILE
-.\"O The system already has the maximum allowed number of open files.
+.TP 
+\fBEMFILE\fP
+呼び出し元プロセスがオープンしているファイル数がすでにプロセスあたりの 上限に達している。
+.TP 
+\fBENFILE\fP
 システム全体でオープンしているファイル数がすでに上限に達している。
-.TP
-.B ENXIO
-.\"O The calling process has no controlling tty.
+.TP 
+\fBENXIO\fP
 呼び出し元プロセスには制御端末がない。
-.TP
-.B ERANGE
-(getlogin_r)
-.\"O The length of the username, including the terminating null byte,
-.\"O is larger than
-.\"O .IR bufsize .
-(終端の NULL バイトも含めた) ユーザ名の長さが
-.I bufsize
-よりも長い。
+.TP 
+\fBERANGE\fP
+(getlogin_r)  (終端の NULL バイトも含めた) ユーザ名の長さが \fIbufsize\fP よりも長い。
 .LP
-.\"O Linux/glibc also has
 Linux/glibc には以下のエラーもある。
-.TP
-.B ENOENT
-.\"O There was no corresponding entry in the utmp-file.
+.TP 
+\fBENOENT\fP
 utmp ファイルに対応するエントリがなかった。
-.TP
-.B ENOMEM
-.\"O Insufficient memory to allocate passwd structure.
+.TP 
+\fBENOMEM\fP
 passwd 構造体を割り当てるのに十分なメモリがない。
-.TP
-.B ENOTTY
-.\"O Standard input didn't refer to a terminal.
-.\"O (See BUGS.)
+.TP 
+\fBENOTTY\fP
 標準入力が端末を参照していない (「バグ」の節を参照)。
-.\"O .SH FILES
 .SH ファイル
-.TP
+.TP 
 \fI/etc/passwd\fP
-.\"O password database file
 パスワードデータベースのファイル
-.TP
+.TP 
 \fI/var/run/utmp\fP
-.\"O (traditionally \fI/etc/utmp\fP;
-.\"O some libc versions used \fI/var/adm/utmp\fP)
-(伝統的には \fI/etc/utmp\fP が使われている;
-libc の中には \fI/var/adm/utmp\fP を使うものもある)
-.\"O .SH "CONFORMING TO"
+(伝統的には \fI/etc/utmp\fP が使われている; libc の中には \fI/var/adm/utmp\fP を使うものもある)
 .SH 準拠
-.\"O .BR getlogin ()
-.\"O and
-.\"O .BR getlogin_r ()
-.\"O specified in POSIX.1-2001.
-.BR getlogin ()
-と
-.BR getlogin_r ()
-は POSIX.1-2001 で規定されている。
+\fBgetlogin\fP()  と \fBgetlogin_r\fP()  は POSIX.1\-2001 で規定されている。
 
-.\"O System V has a
-.\"O .BR cuserid ()
-.\"O function which uses the real
-.\"O user ID rather than the effective user ID.
-.\"O The
-.\"O .BR cuserid ()
-.\"O function
-.\"O was included in the 1988 version of POSIX,
-.\"O but removed from the 1990 version.
-.\"O It was present in SUSv2, but removed in POSIX.1-2001.
-System V にも
-.BR cuserid ()
-があるが、
-これは実効ユーザー ID ではなく、実ユーザー ID を使用する。
-.BR cuserid ()
-関数は 1988 年版の POSIX には含まれていたが、
-1990 年版では削除された。
-SUSv2 に存在したが、POSIX.1-2001 で削除された。
+System V にも \fBcuserid\fP()  があるが、 これは実効ユーザー ID ではなく、実ユーザー ID を使用する。
+\fBcuserid\fP()  関数は 1988 年版の POSIX には含まれていたが、 1990 年版では削除された。 SUSv2
+に存在したが、POSIX.1\-2001 で削除された。
 .LP
-.\"O OpenBSD has
-.\"O .BR getlogin ()
-.\"O and
-.\"O .BR setlogin (),
-.\"O and a username
-.\"O associated with a session, even if it has no controlling tty.
-OpenBSD には
-.BR getlogin ()
-と
-.BR setlogin ()
-があり、
-セッションに対応したユーザ名がある。制御端末がない
+OpenBSD には \fBgetlogin\fP()  と \fBsetlogin\fP()  があり、 セッションに対応したユーザ名がある。制御端末がない
 セッションの場合であっても、対応するユーザ名がある。
-.\"O .SH BUGS
 .SH バグ
-.\"O Unfortunately, it is often rather easy to fool
-.\"O .BR getlogin ().
-.\"O Sometimes it does not work at all, because some program messed up
-.\"O the utmp file.
-.\"O Often, it gives only the first 8 characters of
-.\"O the login name.
-.\"O The user currently logged in on the controlling tty
-.\"O of our program need not be the user who started it.
-.\"O Avoid
-.\"O .BR getlogin ()
-.\"O for security-related purposes.
-残念ながら、
-.BR getlogin ()
-をだますのはそれほど難しいことではない。別のプログラムが utmp ファイルを
-壊してしまうと、全く動作しないこともある。またログイン名の最初の 8 文字
-しか返さないことも多い。またプログラムを制御している tty に
-現在ログインしているユーザーは、プログラムを実行した
-ユーザーでない場合もある。
-セキュリティの絡む用途には
-.BR getlogin ()
+残念ながら、 \fBgetlogin\fP()  をだますのはそれほど難しいことではない。別のプログラムが utmp ファイルを
+壊してしまうと、全く動作しないこともある。またログイン名の最初の 8 文字 しか返さないことも多い。またプログラムを制御している tty に
+現在ログインしているユーザーは、プログラムを実行した ユーザーでない場合もある。 セキュリティの絡む用途には \fBgetlogin\fP()
 を用いるべきではない。
 .LP
-.\"O Note that glibc does not follow the POSIX specification and uses
-.\"O .I stdin
-.\"O instead of
-.\"O .IR /dev/tty .
-.\"O A bug.
-.\"O (Other recent systems, like SunOS 5.8 and HP-UX 11.11 and FreeBSD 4.8
-.\"O all return the login name also when
-.\"O .I stdin
-.\"O is redirected.)
-glibc は POSIX 仕様には従っておらず、
-.I /dev/tty
-ではなく
-.I "標準入力 (stdin)"
-を使う。これはバグである。
-(SunOS 5.8 や HP-UX 11.11 や FreeBSD 4.8 といった他の最近のシステムはいずれも、
-.I 標準入力
+glibc は POSIX 仕様には従っておらず、 \fI/dev/tty\fP ではなく \fI標準入力 (stdin)\fP を使う。これはバグである。
+(SunOS 5.8 や HP\-UX 11.11 や FreeBSD 4.8 といった他の最近のシステムはいずれも、 \fI標準入力\fP
 がリダイレクトされた場合でもログイン名を返す。)
 .LP
-.\"O Nobody knows precisely what
-.\"O .BR cuserid ()
-.\"O does; avoid it in portable programs.
-.\"O Or avoid it altogether: use
-.\"O .I getpwuid(geteuid())
-.\"O instead, if that is
-.\"O what you meant.
-.\"O .B Do not use
-.\"O .BR cuserid ().
-.BR cuserid ()
-が何を行っているのか、実際のところを知っている者は誰もいない;
-移植性が求められるプログラムでは
-.BR cuserid ()
-は使うべきではない。
-というかどんなプログラムでも使うべきではない:
-代わりに
-.I getpwuid(geteuid())
-を用いるべきである
-(これが意図していることならば、だが)。
-.BR cuserid ()
-は「使わない」こと。
-.\"O .SH "SEE ALSO"
+\fBcuserid\fP()  が何を行っているのか、実際のところを知っている者は誰もいない; 移植性が求められるプログラムでは \fBcuserid\fP()
+は使うべきではない。 というかどんなプログラムでも使うべきではない: 代わりに \fIgetpwuid(geteuid())\fP を用いるべきである
+(これが意図していることならば、だが)。 \fBcuserid\fP()  は「使わない」こと。
 .SH 関連項目
-.BR geteuid (2),
-.BR getuid (2),
-.BR utmp (5)
+\fBgeteuid\fP(2), \fBgetuid\fP(2), \fButmp\fP(5)