aboutsummaryrefslogtreecommitdiff
path: root/documentation/manual-pages/ja/man3/getcwd.3
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/manual-pages/ja/man3/getcwd.3')
-rw-r--r--documentation/manual-pages/ja/man3/getcwd.3150
1 files changed, 150 insertions, 0 deletions
diff --git a/documentation/manual-pages/ja/man3/getcwd.3 b/documentation/manual-pages/ja/man3/getcwd.3
new file mode 100644
index 0000000000..c718bbe084
--- /dev/null
+++ b/documentation/manual-pages/ja/man3/getcwd.3
@@ -0,0 +1,150 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)getcwd.3 8.2 (Berkeley) 12/11/93
+.\" %FreeBSD: src/lib/libc/gen/getcwd.3,v 1.7.2.6 2001/12/14 18:33:51 ru Exp %
+.\"
+.\" $FreeBSD$
+.Dd November 24, 1997
+.Dt GETCWD 3
+.Os
+.Sh 名称
+.Nm getcwd ,
+.Nm getwd
+.Nd 作業ディレクトリのパス名を取得する
+.Sh ライブラリ
+.Lb libc
+.Sh 書式
+.In unistd.h
+.Ft char *
+.Fn getcwd "char *buf" "size_t size"
+.Ft char *
+.Fn getwd "char *buf"
+.Sh 解説
+.Fn getcwd
+関数は、現在の作業ディレクトリの絶対パス名を
+.Fa buf
+で参照されるメモリにコピーし、
+.Fa buf
+へのポインタを返します。
+.Fa size
+引数は、
+.Fa buf
+で参照される配列のバイト数によるサイズです。
+.Pp
+.Fa buf
+が
+.Dv NULL
+の場合は、パス名を保存するのに必要なだけの空間が割り振られます。
+この空間は後で
+.Xr free 3
+できます。
+.Pp
+関数
+.Fn getwd
+は、
+.Fn getcwd
+を
+.Fa buf
+引数と、サイズとして (インクルードファイル
+.Aq Pa sys/param.h
+で定義された)
+.Dv MAXPATHLEN
+を用いて呼び出したのと同等の関数です。
+.Fa buf
+が少なくとも、
+.Dv MAXPATHLEN
+バイトの長さを持たなければならないことは明らかです。
+.Pp
+これらのルーチンは従来、作業ディレクトリに戻ってくるために
+その名前を保存するようなプログラムによって使用されてきました。
+これをより速く誤りなく遂行するものとして、カレントディレクトリ
+.Pq Ql .\&
+をオープンしておき、
+.Xr fchdir 2
+関数を使って戻る方法があります。
+.Sh 戻り値
+無事に完了した場合はパス名へのポインタが返ります。
+そうでなければ
+.Dv NULL
+ポインタが返り、エラーを示すためグローバル変数
+.Va errno
+が設定され、さらに
+.Fn getwd
+が
+.Va errno
+に関連するエラーメッセージを
+.Fa buf
+で参照されるメモリにコピーします。
+.Sh エラー
+.Fn getcwd
+関数は次の場合に失敗します。
+.Bl -tag -width Er
+.It Bq Er EACCES
+パス名の構成要素において、
+読み込みまたは検索のパーミッションが拒否されました。
+.Pp
+.It Bq Er EINVAL
+.Fa size
+引数が 0 です。
+.It Bq Er ENOENT
+パス名の構成要素がもはや存在しません。
+.It Bq Er ENOMEM
+利用できるメモリが十分ではありません。
+.It Bq Er ERANGE
+.Fa size
+引数が、0 よりも大きいですが、パス名 + 1 よりも小さいです。
+.El
+.Sh 関連項目
+.Xr chdir 2 ,
+.Xr fchdir 2 ,
+.Xr malloc 3 ,
+.Xr strerror 3
+.Pp
+.Sh 規格
+.Fn getcwd
+関数は、
+.St -p1003.1-90
+に適合しています。
+.Dv NULL
+ポインタを指定して、必要に応じて
+.Fn getcwd
+にメモリを割り振らせる機能は拡張部分です。
+.Sh 歴史
+.Fn getwd
+関数は、
+.Bx 4.0
+ではじめて登場しました。
+.Sh バグ
+.Fn getwd
+関数はエラーチェックを十分に行っていません。
+また非常に長いパス名は、有効でも返すことができません。
+この関数は、互換性のために提供されています。