OSDN Git Service

(split) LDP: Update draft and release (from the previous commit)
[linuxjm/LDP_man-pages.git] / draft / man3 / ftw.3
index 30e1777..68b243b 100644 (file)
@@ -1,8 +1,9 @@
-.\" Copyright (c) 1993 Michael Haardt (u31b3hs@pool.informatik.rwth-aachen.de)
+.\" Copyright (c) 1993 Michael Haardt (michael@moria.de)
 .\" and copyright (c) 1999 Andries Brouwer (aeb@cwi.nl)
 .\" and copyright (c) 2006 Justin Pryzby <justinpryzby@users.sf.net>
 .\" and copyright (c) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
+.\" %%%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
@@ -19,9 +20,9 @@
 .\" 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, write to the Free
-.\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-.\" USA.
+.\" License along with this manual; if not, see
+.\" <http://www.gnu.org/licenses/>.
+.\" %%%LICENSE_END
 .\"
 .\" Modified Sun Jul 25 11:02:22 1993 by Rik Faith (faith@cs.unc.edu)
 .\" 2006-05-24, Justin Pryzby <justinpryzby@users.sf.net>
 .\"    reorganized and rewrote much of the page
 .\" 2006-05-24, Michael Kerrisk <mtk.manpages@gmail.com>
 .\"    Added an example program.
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
 .\"
 .\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
 .\" Translated 1998-04-28, NAKANO Takeo <nakano@apm.seikei.ac.jp>
 .\" Updated & Modified 2005-11-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\" Updated 2006-07-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
 .\"
-.\" WORD:       file descriptor         ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
-.\"
-.TH FTW 3 2010-09-20 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O ftw, nftw \- file tree walk
-ftw, nftw \- ¥Õ¥¡¥¤¥ë¥Ä¥ê¡¼¤òÊ⤭¤Þ¤ï¤ë
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.TH FTW 3 2014\-01\-11 Linux "Linux Programmer's Manual"
+.SH 名前
+ftw, nftw \- ファイルツリーを歩きまわる
+.SH 書式
 .nf
-.B #include <ftw.h>
+\fB#include <ftw.h>\fP
 .sp
-.BI "int ftw(const char *" dirpath ,
-.BI "        int (*" fn ") (const char *" fpath ", const struct stat *" sb ,
-.BI "                   int " typeflag ),
-.BI "        int " nopenfd );
+\fBint ftw(const char *\fP\fIdirpath\fP\fB,\fP
+\fB        int (*\fP\fIfn\fP\fB) (const char *\fP\fIfpath\fP\fB, const struct stat *\fP\fIsb\fP\fB,\fP
+\fB                   int \fP\fItypeflag\fP\fB),\fP
+\fB        int \fP\fInopenfd\fP\fB);\fP
 .sp
-.\"O+ .BR "#define _XOPEN_SOURCE 500" "   /* See feature_test_macros(7) */"
-.BR "#define _XOPEN_SOURCE 500" "   /* feature_test_macros(7) »²¾È */"
-.B #define _XOPEN_SOURCE 500
-.B #include <ftw.h>
+\fB#define _XOPEN_SOURCE 500\fP   /* feature_test_macros(7) 参照 */
+\fB#define _XOPEN_SOURCE 500\fP
+\fB#include <ftw.h>\fP
 .sp
-.BI "int nftw(const char *" dirpath ,
-.BI "        int (*" fn ") (const char *" fpath ", const struct stat *" sb ,
-.BI "                   int " typeflag ", struct FTW *" ftwbuf ),
-.BI "        int " nopenfd ", int " flags );
+\fBint nftw(const char *\fP\fIdirpath\fP\fB,\fP
+\fB        int (*\fP\fIfn\fP\fB) (const char *\fP\fIfpath\fP\fB, const struct stat *\fP\fIsb\fP\fB,\fP
+\fB                   int \fP\fItypeflag\fP\fB, struct FTW *\fP\fIftwbuf\fP\fB),\fP
+\fB        int \fP\fInopenfd\fP\fB, int \fP\fIflags\fP\fB);\fP
 .fi
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O .BR ftw ()
-.\"O walks through the directory tree that is
-.\"O located under the directory \fIdirpath\fP,
-.\"O and calls \fIfn\fP() once for each entry in the tree.
-.\"O By default, directories are handled before the files and
-.\"O subdirectories they contain (preorder traversal).
-.BR ftw ()
-¤Ï¡¢
-.I dirpath
-¤Ç»ØÄꤵ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Î¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼Á´ÂΤòÊ⤭¤Þ¤ï¤ê¡¢
-¥Ä¥ê¡¼Ãæ¤Ç¥¨¥ó¥È¥ê¤¬¸«ÉÕ¤«¤ë¤´¤È¤Ë¡¢
-.IR fn ()
-¤ò¸Æ¤Ó½Ð¤¹¡£
-¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥Ç¥£¥ì¥¯¥È¥ê¤½¤Î¤â¤Î¤¬¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤ä
-¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤è¤ê¤âÀè¤Ë½èÍý¤µ¤ì¤ë (¹Ô¤­¤¬¤±½çõº÷; preorder traversal)¡£
+.SH 説明
+\fBftw\fP()  は、 \fIdirpath\fP で指定されたディレクトリ以下のディレクトリツリー全体を歩きまわり、 ツリー中でエントリが見付かるごとに、
+\fIfn\fP()  を呼び出す。 デフォルトでは、ディレクトリそのものが、そのディレクトリにあるファイルや サブディレクトリよりも先に処理される
+(行きがけ順探索; preorder traversal)。
 
-.\"O To avoid using up all of the calling process's file descriptors,
-.\"O \fInopenfd\fP specifies the maximum number of directories that
-.\"O .BR ftw ()
-.\"O will hold open simultaneously.
-.\"O When
-.\"O the search depth exceeds this,
-.\"O .BR ftw ()
-.\"O will become slower because
-.\"O directories have to be closed and reopened.
-.\"O .BR ftw ()
-.\"O uses at most
-.\"O one file descriptor for each level in the directory tree.
-¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤¬ÍøÍѲÄǽ¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò»È¤¤ÀڤäÆ
-¤·¤Þ¤ï¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤¿¤á¡¢
-.BR ftw ()
-¤¬Æ±»þ¤Ë¥ª¡¼¥×¥ó¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ÎºÇÂç¿ô¤ò
-.I nopenfd
-¤Ç»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
-õº÷¤Î¿¼¤µ¤¬¤³¤ÎÃͤò±Û¤¨¤ë¤È¡¢
-°ì¤Ä¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òÊĤ¸¤Æ¤«¤é¾¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¥ª¡¼¥×¥ó¤·Ä¾¤¹¤³¤È
-¤Ë¤Ê¤ë¤Î¤Ç¡¢
-.BR ftw ()
-¤ÎÆ°ºî¤ÏÃÙ¤¯¤Ê¤ë¡£
-.BR ftw ()
-¤Ï¡¢¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤Î³¬ÁØ 1 ¥ì¥Ù¥ë¤Ë¤Ä¤­¡¢
-ºÇÂç¤Ç¤â°ì¤Ä¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤·¤«»ÈÍѤ·¤Ê¤¤¡£
+呼び出し元プロセスが利用可能なファイルディスクリプタを使い切って しまわないようにするため、 \fBftw\fP()
+が同時にオープンするディレクトリの最大数を \fInopenfd\fP で指定することができる。 探索の深さがこの値を越えると、
+一つのディレクトリを閉じてから他のディレクトリをオープンし直すこと になるので、 \fBftw\fP()  の動作は遅くなる。 \fBftw\fP()
+は、ディレクトリツリーの階層 1 レベルにつき、 最大でも一つのファイルディスクリプタしか使用しない。
 
-.\"O For each entry found in the tree,
-.\"O .BR ftw ()
-.\"O calls
-.\"O \fIfn\fP() with three arguments:
-.\"O .IR fpath ,
-.\"O .IR sb ,
-.\"O and
-.\"O .IR typeflag .
-¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤Ç¸«¤Ä¤«¤Ã¤¿¥¨¥ó¥È¥êËè¤Ë¡¢
-.BR ftw ()
-¤Ï
-.IR fpath ,
-.IR sb ,
-.I typeflag
-¤Î 3¤Ä¤ò°ú¤­¿ô¤È¤·¤Æ
-.IR fn ()
-¤ò¸Æ¤Ó½Ð¤¹¡£
-.\"O .I fpath
-.\"O is the pathname of the entry,
-.\"O and is expressed either as a pathname relative to the calling process's
-.\"O current working directory at the time of the call to
-.\"O .BR ftw (),
-.\"O if
-.\"O .IR dirpath
-.\"O was expressed as a relative pathname,
-.\"O or as an absolute pathname, if
-.\"O .I dirpath
-.\"O was expressed as an absolute pathname.
-.I fpath
-¤Ï¥¨¥ó¥È¥ê¤Î¥Ñ¥¹Ì¾¤Ç¤¢¤ë¡£
-.I dirpath
-¤¬ÁêÂХѥ¹Ì¾¤Ç»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢
-.I fpath
-¤Ï
-.BR ftw ()
-¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿»þÅÀ¤Î¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê
-¤«¤é¤ÎÁêÂХѥ¹Ì¾¤È¤Ê¤ë¡£
-.I dirpath
-¤¬ÀäÂХѥ¹Ì¾¤Ç»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢
-.I fpath
-¤ÏÀäÂХѥ¹Ì¾¤È¤Ê¤ë¡£
-.\"O .I sb
-.\"O is a pointer to the
-.\"O .I stat
-.\"O structure returned by a call to
-.\"O .BR stat (2)
-.\"O for
-.\"O .IR fpath .
-.I sb
-¤Ï
-.I fpath
-¤ËÂФ¹¤ë
-.BR stat (2)
-¤Î¸Æ¤Ó½Ð¤·¤ÇÊÖ¤µ¤ì¤ë
-.I stat
-¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤¢¤ë¡£
-.\"O .I typeflag
-.\"O is an integer that has one of the following values:
-.I typeflag
-¤ÏÀ°¿ô¤Ç¡¢°Ê²¼¤ÎÃͤΤ¤¤º¤ì¤«°ì¤Ä¤Ç¤¢¤ë:
-.TP
-.B FTW_F
-.\"O .I fpath
-.\"O is a regular file.
-.I fpath
-¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë
-.TP
-.B FTW_D
-.\"O .I fpath
-.\"O is a directory.
-.I fpath
-¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë
-.TP
-.B FTW_DNR
-.\"O .I fpath
-.\"O is a directory which can't be read.
-.I fpath
-¤¬Æɤ߹þ¤ß¤Ç¤­¤Ê¤¤¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë
-.TP
-.B FTW_NS
-.\"O The
-.\"O .BR stat (2)
-.\"O call failed on
-.\"O .IR fpath ,
-.\"O which is not a symbolic link.
-¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ç¤Ï¤Ê¤¤
-.I fpath
-¤ËÂФ¹¤ë
-.BR stat (2)
-¸Æ¤Ó½Ð¤·¤¬¼ºÇÔ¤·¤¿¡£
+ディレクトリツリーで見つかったエントリ毎に、 \fBftw\fP()  は \fIfpath\fP, \fIsb\fP, \fItypeflag\fP の 3つを引き数として
+\fIfn\fP()  を呼び出す。 \fIfpath\fP はエントリのパス名である。 \fIdirpath\fP が相対パス名で指定された場合には、 \fIfpath\fP
+は \fBftw\fP()  が呼び出された時点の呼び出し元プロセスのカレントワーキングディレクトリ からの相対パス名となる。 \fIdirpath\fP
+が絶対パス名で指定された場合には、 \fIfpath\fP は絶対パス名となる。 \fIsb\fP は \fIfpath\fP に対する \fBstat\fP(2)
+の呼び出しで返される \fIstat\fP 構造体へのポインタである。 \fItypeflag\fP は整数で、以下の値のいずれか一つである:
+.TP 
+\fBFTW_F\fP
+\fIfpath\fP が通常のファイルである
+.TP 
+\fBFTW_D\fP
+\fIfpath\fP がディレクトリである
+.TP 
+\fBFTW_DNR\fP
+\fIfpath\fP が読み込みできないディレクトリである
+.TP 
+\fBFTW_NS\fP
+\fBstat\fP(2) の呼び出しがシンボリックリンクでない \fIfpath\fP で失敗した。
+これのよくある原因は、呼び出し元が親ディレクトリに対する読み込み許可を持っており、 ファイル名 \fIfpath\fP
+を見ることができたが、実行許可は持っておらず、 そのため \fBstat\fP(2) ではそのファイルに到達できなかった、というものである。
 .sp
-.\"O If
-.\"O .I fpath
-.\"O is a symbolic link and
-.\"O .BR stat (2)
-.\"O failed, POSIX.1-2001 states
-.\"O that it is undefined whether \fBFTW_NS\fP or \fBFTW_SL\fP (see below)
-.\"O is passed in
-.\"O .IR typeflag .
-.I fpath
-¤¬¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ç¡¢¤«¤Ä
-.BR stat (2)
-¤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢
-.B FTW_NS
-¤È
-.B FTW_SL
-(¸å½Ò) ¤Î¤É¤Á¤é¤¬
-.I typeflag
-¤ËÅϤµ¤ì¤ë¤«¤Ï̤ÄêµÁ¤Ç¤¢¤ë¤È¡¢POSIX.1-2001 ¤Ë¤Ï½ñ¤«¤ì¤Æ¤¤¤ë¡£
+\fIfpath\fP がシンボリックリンクで、かつ \fBstat\fP(2)  が失敗した場合、 \fBFTW_NS\fP と \fBFTW_SL\fP (後述)
+のどちらが \fItypeflag\fP に渡されるかは未定義であると、POSIX.1\-2001 には書かれている。
 .PP
-.\"O To stop the tree walk, \fIfn\fP() returns a nonzero value; this
-.\"O value will become the return value of
-.\"O .BR ftw ().
-.\"O As long as \fIfn\fP() returns 0,
-.\"O .BR ftw ()
-.\"O will continue either until it has traversed the entire tree,
-.\"O in which case it will return zero,
-.\"O or until it encounters an error (such as a
-.\"O .BR malloc (3)
-.\"O failure), in which case it will return \-1.
-¥Ä¥ê¡¼¤Îõº÷¤ò»ß¤á¤¿¤¤¾ì¹ç¤Ï¡¢
-.IR fn ()
-¤¬ 0 °Ê³°¤ÎÃͤòÊÖ¤»¤ÐÎɤ¤
-(¤³¤ÎÃͤÏ
-.BR ftw ()
-¼«¿È¤ÎÌá¤êÃͤȤʤë)¡£
-¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï
-.BR ftw ()
-¤Ï¥Ä¥ê¡¼Á´ÂΤÎõº÷¤ò³¤±¡¢¤¹¤Ù¤Æ¤Î¥Ä¥ê¡¼¤òõº÷¤·½ª¤¨¤¿¤È¤³¤í¤Ç
-0 ¤òÊÖ¤¹¡£Ãµº÷Ãæ¤Ë
-.RB ( malloc (3)
-¤Î¼ºÇԤʤɤÎ) ¥¨¥é¡¼¤¬µ¯¤³¤ë¤È \-1 ¤òÊÖ¤¹¡£
+ツリーの探索を止めたい場合は、 \fIfn\fP()  が 0 以外の値を返せば良い (この値は \fBftw\fP()  自身の戻り値となる)。 それ以外の場合は
+\fBftw\fP()  はツリー全体の探索を続け、すべてのツリーを探索し終えたところで 0 を返す。探索中に (\fBmalloc\fP(3)  の失敗などの)
+エラーが起こると \-1 を返す。
 .PP
-.\"O Because
-.\"O .BR ftw ()
-.\"O uses dynamic data structures, the only safe way to
-.\"O exit out of a tree walk is to return a nonzero value from \fIfn\fP().
-.\"O To allow a signal to terminate the walk without causing a memory leak,
-.\"O have the handler set a global flag that is checked by \fIfn\fP().
-.\"O \fIDon't\fP use
-.\"O .BR longjmp (3)
-.\"O unless the program is going to terminate.
-.BR ftw ()
-¤ÏưŪ¤Ê¥Ç¡¼¥¿¹½Â¤¤òÍѤ¤¤ë¤Î¤Ç¡¢¥Ä¥ê¡¼Ãµº÷¤ò°ÂÁ´¤ËÃæÃǤ¹¤ëÍ£°ì¤ÎÊýË¡¤Ï
-0 °Ê³°¤ÎÃͤò
-.IR fn ()
-¤ÎÊÖ¤êÃͤȤ¹¤ë¤³¤È¤Ç¤¢¤ë¡£³ä¤ê¹þ¤ß¤ò°·¤¦¤Ë¤Ï¡¢
-Î㤨¤ÐȯÀ¸¤·¤¿³ä¤ê¹þ¤ß¤ò¥Þ¡¼¥¯¤·¤Æ¤ª¤¤¤Æ¡¢ 0 °Ê³°¤ÎÃͤòÊÖ¤¹¤è¤¦¤Ë¤¹¤ë
-¥·¥°¥Ê¥ë¤Ë¤è¤ê¥á¥â¥ê¥ê¡¼¥¯¤òµ¯¤³¤µ¤º¤Ëõº÷¤ò½ªÎ»¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¤Ë¤Ï¡¢
-¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ç
-.IR fn ()
-¤¬¥Á¥§¥Ã¥¯¤¹¤ë¥°¥í¡¼¥Ð¥ë¤Ê¥Õ¥é¥°¤ò¥»¥Ã¥È¤¹¤ë¤è¤¦¤Ë¤¹¤ì¤Ð¤è¤¤¡£
-¥×¥í¥°¥é¥à¤ò½ªÎ»¤µ¤»¤ë¾ì¹ç°Ê³°¤Ï¡¢
-.BR longjmp (3)
-¤ò»ÈÍѤ·¤Ê¤¤¤³¤È¡£
+\fBftw\fP()  は動的なデータ構造を用いるので、ツリー探索を安全に中断する唯一の方法は 0 以外の値を \fIfn\fP()
+の返り値とすることである。割り込みを扱うには、 例えば発生した割り込みをマークしておいて、 0 以外の値を返すようにする
+シグナルによりメモリリークを起こさずに探索を終了できるようにするには、 シグナルハンドラで \fIfn\fP()
+がチェックするグローバルなフラグをセットするようにすればよい。 プログラムを終了させる場合以外は、 \fBlongjmp\fP(3)  を使用しないこと。
 .SS nftw()
-.\"O The function \fBnftw\fP() is the same as
-.\"O .BR ftw (),
-.\"O except that it has one additional argument, \fIflags\fP,
-.\"O and calls \fIfn\fP() with one more argument, \fIftwbuf\fP.
-´Ø¿ô
-.BR nftw ()
-¤Ï
-.BR ftw ()
-¤ÈƱ¤¸¤À¤¬¡¢°ú¤­¿ô
-.I flags
-¤¬Äɲ䵤ì¤ëÅÀ¤È¡¢
-.IR fn ()
-¤Î°ú¤­¿ô¤Ë
-.I ftwbuf
-¤¬Äɲ䵤ì¤ëÅÀ¤¬°Û¤Ê¤ë¡£
+関数 \fBnftw\fP()  は \fBftw\fP()  と同じだが、引き数 \fIflags\fP が追加される点と、 \fIfn\fP()  の引き数に
+\fIftwbuf\fP が追加される点が異なる。
 
-.\"O This \fIflags\fP argument is formed by ORing zero or more of the
-.\"O following flags:
-¤³¤Î
-.I flags
-°ú¤­¿ô¤Ï²¼µ­¤Î¥Õ¥é¥°¤Î 0 ¸Ä°Ê¾å¤ÎÏÀÍýϤò¼è¤Ã¤¿¤â¤Î¤Ç¤¢¤ë:
-.TP
-.\"O .BR FTW_ACTIONRETVAL " (since glibc 2.3.3)"
-.BR FTW_ACTIONRETVAL " (glibc 2.3.3 °Ê¹ß)"
-.\"O If this glibc-specific flag is set, then
-.\"O .BR nftw ()
-.\"O handles the return value from
-.\"O .IR fn ()
-.\"O differently.
-.\"O .IR fn ()
-.\"O should return one of the following values:
-¤³¤Î¥Õ¥é¥°¤Ï glibc ¸ÇÍ­¤Ç¤¢¤ë¡£
-¤³¤Î¥Õ¥é¥°¤ò¥»¥Ã¥È¤¹¤ë¤È¡¢
-.BR nftw ()
-¤Î
-.IR fn ()
-¤ÎÊÖ¤êÃͤΰ·¤¤¤¬ÊѤï¤ë¡£
-.IR fn ()
-¤Ï°Ê²¼¤ÎÃͤΤ¤¤º¤ì¤«°ì¤Ä¤òÊÖ¤¹É¬Íפ¬¤¢¤ë¡£
+この \fIflags\fP 引き数は下記のフラグの 0 個以上の論理和を取ったものである:
+.TP 
+\fBFTW_ACTIONRETVAL\fP (glibc 2.3.3 以降)
+このフラグは glibc 固有である。 このフラグをセットすると、 \fBnftw\fP()  の \fIfn\fP()  の返り値の扱いが変わる。 \fIfn\fP()
+は以下の値のいずれか一つを返す必要がある。
 .RS
-.TP
-.B FTW_CONTINUE
-.\"O Instructs
-.\"O .BR nftw ()
-.\"O to continue normally.
-.BR nftw ()
-¤ÏÄ̾ïÄ̤ê½èÍý¤ò³¤±¤ë¡£
-.TP
-.B FTW_SKIP_SIBLINGS
-.\"O If \fIfn\fP() returns this value, then
-.\"O siblings of the current entry will be skipped,
-.\"O and processing continues in the parent.
-.IR fn ()
-¤¬¤³¤ÎÃͤòÊÖ¤·¤¿¾ì¹ç¡¢½èÍýÃæ¤Î¥¨¥ó¥È¥ê¤Î·»Äï (Ʊ¤¸³¬ÁؤΥ¨¥ó¥È¥ê)
-¤Î½èÍý¤Ï¥¹¥­¥Ã¥×¤µ¤ì¡¢¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Ç³¤­¤Î½èÍý¤¬¹Ô¤ï¤ì¤ë¡£
+.TP 
+\fBFTW_CONTINUE\fP
+\fBnftw\fP()  は通常通り処理を続ける。
+.TP 
+\fBFTW_SKIP_SIBLINGS\fP
 .\" If \fBFTW_DEPTH\fP
 .\" is set, the entry's parent directory is processed next (with
 .\" \fIflag\fP set to \fBFTW_DP\fP).
-.TP
-.B FTW_SKIP_SUBTREE
-.\"O If \fIfn\fP() is called with an entry that is a directory
-.\"O (\fItypeflag\fP is \fBFTW_D\fP), this return
-.\"O value will prevent objects within that directory from being passed as
-.\"O arguments to \fIfn\fP().
-.\"O .BR nftw ()
-.\"O continues processing with the next sibling of the directory.
-.IR fn ()
-¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿¥¨¥ó¥È¥ê¤¬¥Ç¥£¥ì¥¯¥È¥ê
-.RI ( typeflag
-¤¬
-.BR FTW_D )
-¤Î¾ì¹ç¤Ë¡¢¤³¤ÎÃͤòÊÖ¤¹¤È
-.IR fn ()
-¤Î°ú¤­¿ô¤È¤·¤ÆÅϤµ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥êÆâ¤Î¥¨¥ó¥È¥ê¤Î½èÍý¤¬¹Ô¤ï¤ì¤Ê¤¯¤Ê¤ë¡£
-.BR nftw ()
-¤Ï½èÍýÃæ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î·»Äï (Ʊ¤¸³¬ÁؤΥ¨¥ó¥È¥ê) ¤«¤é½èÍý¤ò³¤±¤ë¡£
-.TP
-.B FTW_STOP
-.\"O Causes
-.\"O .BR nftw ()
-.\"O to return immediately with the return value
-.\"O \fBFTW_STOP\fP.
-.B nftw ()
-¤Ï¡¢ÊÖ¤êÃÍ
-.B FTW_STOP
-¤Ç¤¹¤°¤ËÉüµ¢¤¹¤ë¡£
+\fIfn\fP()  がこの値を返した場合、処理中のエントリの兄弟 (同じ階層のエントリ)  の処理はスキップされ、親ディレクトリで続きの処理が行われる。
+.TP 
+\fBFTW_SKIP_SUBTREE\fP
+\fIfn\fP()  が呼び出されたエントリがディレクトリ (\fItypeflag\fP が \fBFTW_D\fP)  の場合に、この値を返すと \fIfn\fP()
+の引き数として渡されたディレクトリ内のエントリの処理が行われなくなる。 \fBnftw\fP()  は処理中のディレクトリの兄弟 (同じ階層のエントリ)
+から処理を続ける。
+.TP 
+\fBFTW_STOP\fP
+\fBnftw ()\fP は、返り値 \fBFTW_STOP\fP ですぐに復帰する。
 .PP
-.\"O Other return values could be associated with new actions in the future;
-.\"O \fIfn\fP() should not return values other than those listed above.
-¾¤ÎÊÖ¤êÃͤϾ­Íè¿·¤·¤¤Æ°ºî¤ËÂбþÉÕ¤±¤é¤ì¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
-.IR fn ()
-¤Ï¾åµ­¤Î¥ê¥¹¥È¤Ë¤¢¤ëÃͰʳ°¤òÊÖ¤µ¤Ê¤¤¤è¤¦¤Ë¤¹¤Ù¤­¤Ç¤¢¤ë¡£
+他の返り値は将来新しい動作に対応付けられる可能性がある。 \fIfn\fP()  は上記のリストにある値以外を返さないようにすべきである。
 
-.\"O The feature test macro
-.\"O .B _GNU_SOURCE
-.\"O must be defined
-.\"O (before including
-.\"O .I any
-.\"O header files)
-.\"O in order to
-.\"O obtain the definition of \fBFTW_ACTIONRETVAL\fP from \fI<ftw.h>\fP.
-.I <ftw.h>
-¤Ç
-.B FTW_ACTIONRETVAL
-¤ÎÄêµÁ¤¬Í­¸ú¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¡¢
-(¡Ö¤É¤Î¡×¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤è¤ê¤âÁ°¤Ë)
-µ¡Ç½¸¡ºº¥Þ¥¯¥í
-.B _GNU_SOURCE
-¤òÄêµÁ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+\fI<ftw.h>\fP で \fBFTW_ACTIONRETVAL\fP の定義が有効にするためには、
+(「どの」ヘッダファイルをインクルードするよりも前に)  機能検査マクロ \fB_GNU_SOURCE\fP を定義しなければならない。
 .RE
-.TP
-.B FTW_CHDIR
-.\"O If set, do a
-.\"O .BR chdir (2)
-.\"O to each directory before handling its contents.
-.\"O This is useful if the program needs to perform some action
-.\"O in the directory in which \fIfpath\fP resides.
-¥»¥Ã¥È¤µ¤ì¤ë¤È¡¢¥Ç¥£¥ì¥¯¥È¥ê¤ÎÆâÍƤò½èÍý¤¹¤ëÁ°¤Ë
-¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë
-.BR chdir (2)
-¤¹¤ë¡£¤³¤Î¥Õ¥é¥°¤Ï¡¢
-.I fpath
-¤¬Â°¤¹¥Ç¥£¥ì¥¯¥È¥ê¤Ç²¿¤é¤«¤ÎÆ°ºî¤ò¼Â¹Ô¤¹¤ëɬÍפ¬¤¢¤ë¾ì¹ç¤Ë
-ÊØÍø¤Ç¤¢¤ë¡£
-.TP
-.B FTW_DEPTH
-.\"O If set, do a post-order traversal, that is, call \fIfn\fP() for
-.\"O the directory itself \fIafter\fP handling the contents of the directory
-.\"O and its subdirectories.
-.\"O (By default, each directory is handled \fIbefore\fP its contents.)
-¥»¥Ã¥È¤µ¤ì¤ë¤È¡¢µ¢¤ê¤¬¤±½çõº÷ (post-order traversal) ¤ò¹Ô¤¦¡£
-¤Ä¤Þ¤ê¡¢¥Ç¥£¥ì¥¯¥È¥ê¤½¤Î¤â¤Î¤ò°ú¤­¿ô¤È¤·¤¿
-.IR fn ()
-¸Æ½Ð¤·¤Ï¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë´Þ¤Þ¤ì¤ë¥Õ¥¡¥¤¥ë¤È¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤Ë
-ÂФ¹¤ë½èÍý¤Î¡Ö¸å¤Ç¡×¹Ô¤ï¤ì¤ë
-(¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥Ç¥£¥ì¥¯¥È¥ê¼«¿È¤Î½èÍý¤Ï¥Ç¥£¥ì¥¯¥È¥êÆâ¤Î¥¨¥ó¥È¥ê
-¤è¤ê¡ÖÁ°¤Ë¡×¹Ô¤Ê¤ï¤ì¤ë)¡£
-.TP
-.B FTW_MOUNT
-.\"O If set, stay within the same file system
-.\"O (i.e., do not cross mount points).
-¥»¥Ã¥È¤µ¤ì¤ë¤È¡¢Æ±¤¸¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ÎÃæ¤À¤±¤òõº÷ÂоݤȤ¹¤ë
-(¤Ä¤Þ¤ê¡¢¥Þ¥¦¥ó¥È¥Ý¥¤¥ó¥È¤ò¤Þ¤¿¤°¤³¤È¤Ï¤Ê¤¤)¡£
-.TP
-.B FTW_PHYS
-.\"O If set, do not follow symbolic links.
-.\"O (This is what you want.)
-.\"O If not set, symbolic links are followed, but no file is reported twice.
-¥»¥Ã¥È¤µ¤ì¤ë¤È¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤òé¤é¤Ê¤¤ (¤ª¤½¤é¤¯¤³¤Á¤é¤¬
-Ä̾ï˾¤Þ¤·¤¤Æ°ºî¤À¤í¤¦)¡£¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¤È¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ò
-é¤ë¤¬¡¢Æ±¤¸¥Õ¥¡¥¤¥ë¤¬Æó²óÊó¹ð¤µ¤ì¤ë¤³¤È¤Ï¤Ê¤¤¡£
+.TP 
+\fBFTW_CHDIR\fP
+セットされると、ディレクトリの内容を処理する前に そのディレクトリに \fBchdir\fP(2)  する。このフラグは、 \fIfpath\fP
+が属すディレクトリで何らかの動作を実行する必要がある場合に 便利である。
+.TP 
+\fBFTW_DEPTH\fP
+セットされると、帰りがけ順探索 (post\-order traversal) を行う。 つまり、ディレクトリそのものを引き数とした \fIfn\fP()
+呼出しは、そのディレクトリに含まれるファイルとサブディレクトリに 対する処理の「後で」行われる
+(デフォルトでは、ディレクトリ自身の処理はディレクトリ内のエントリ より「前に」行なわれる)。
+.TP 
+\fBFTW_MOUNT\fP
+セットされると、同じファイルシステムの中だけを探索対象とする (つまり、マウントポイントをまたぐことはない)。
+.TP 
+\fBFTW_PHYS\fP
+セットされると、シンボリックリンクを辿らない (おそらくこちらが 通常望ましい動作だろう)。セットされていないとシンボリックリンクを
+辿るが、同じファイルが二回報告されることはない。
 .sp
-.\"O If \fBFTW_PHYS\fP is not set, but \fBFTW_DEPTH\fP is set,
-.\"O then the function
-.\"O .IR fn ()
-.\"O is never called for a directory that would be a descendant of itself.
-.B FTW_PHYS
-¤¬¥»¥Ã¥È¤µ¤ì¤º¤Ë
-.B FTW_DEPTH
-¤¬¥»¥Ã¥È¤µ¤ì¤ë¤È¡¢¼«Ê¬¼«¿È¤ËÂФ¹¤ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤òÇÛ²¼¤Ë»ý¤Ä
-¥Ç¥£¥ì¥¯¥È¥ê¤ËÂФ·¤Æ
-.IR fn ()
-¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤³¤È¤Ï·è¤·¤Æ¤Ê¤¤¡£
+\fBFTW_PHYS\fP がセットされずに \fBFTW_DEPTH\fP がセットされると、自分自身に対するシンボリックリンクを配下に持つ
+ディレクトリに対して \fIfn\fP()  が呼び出されることは決してない。
 .LP
-.\"O For each entry in the directory tree,
-.\"O .BR nftw ()
-.\"O calls
-.\"O .IR fn ()
-.\"O with four arguments.
-.\"O .I fpath
-.\"O and
-.\"O .I sb
-.\"O are as for
-.\"O .BR ftw ().
-.\"O .I typeflag
-.\"O may receive any of the same values as with
-.\"O .BR ftw (),
-.\"O or any of the following values:
-¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤Î¥¨¥ó¥È¥êËè¤Ë¡¢
-.BR nftw ()
-¤Ï 4¤Ä¤Î°ú¤­¿ô¤Ç
-.IR fn ()
-¤ò¸Æ¤Ó½Ð¤¹¡£
-.I fpath
-¤È
-.I sb
-¤Ï
-.BR ftw ()
-¤ÈƱ¤¸¤Ç¤¢¤ë¡£
-.I typeflag
-¤Ë¤Ï¡¢
-.BR ftw ()
-¤Ç¼è¤êÆÀ¤ëÃͤΤ¤¤º¤ì¤«¡¢¤Þ¤¿¤Ï°Ê²¼¤ÎÃͤΤ¤¤º¤ì¤«¤¬ÅϤµ¤ì¤ë:
-.TP
-.B FTW_DP
-.\"O .I fpath
-.\"O is a directory, and \fBFTW_DEPTH\fP was specified in \fIflags\fP.
-.\"O All of the files
-.\"O and subdirectories within \fIfpath\fP have been processed.
-.I fpath
-¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¡¢¤«¤Ä
-.I flags
-¤Ç
-.B FTW_DEPTH
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¡£
-.I fpath
-ÇÛ²¼¤Î¥Õ¥¡¥¤¥ë¤È¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤ÏÁ´¤Æ½èÍý¤¬½ª¤ï¤Ã¤Æ¤¤¤ë¡£
-.TP
-.B FTW_SL
-.\"O .I fpath
-.\"O is a symbolic link, and \fBFTW_PHYS\fP was set in \fIflags\fP.
-.I fpath
-¤¬¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ç¡¢¤«¤Ä \fBFTW_PHYS\fP ¤¬ \fIflags\fP ¤Ë
-¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤¿¡£
+ディレクトリツリーのエントリ毎に、 \fBnftw\fP()  は 4つの引き数で \fIfn\fP()  を呼び出す。 \fIfpath\fP と \fIsb\fP は
+\fBftw\fP()  と同じである。 \fItypeflag\fP には、 \fBftw\fP()  で取り得る値のいずれか、または以下の値のいずれかが渡される:
+.TP 
+\fBFTW_DP\fP
+\fIfpath\fP がディレクトリで、かつ \fIflags\fP で \fBFTW_DEPTH\fP が指定されていた (\fBFTW_DEPTH\fP が
+\fIflags\fP に指定されていなかった場合、 ディレクトリに対しては常に \fItypeflag\fP が \fBFTW_D\fP で \fIfn\fP()
+が呼び出される)。 \fIfpath\fP 配下のファイルとサブディレクトリは全て処理が終わっている。
+.TP 
+\fBFTW_SL\fP
 .\" To obtain the definition of this constant from
 .\" .IR <ftw.h> ,
 .\" either
@@ -487,28 +175,13 @@ ftw, nftw \- 
 .\" must be defined, or
 .\" .BR _XOPEN_SOURCE
 .\" must be defined with a value of 500 or more.
-.TP
-.B FTW_SLN
-.\"O .I fpath
-.\"O is a symbolic link pointing to a nonexistent file.
-.\"O (This occurs only if \fBFTW_PHYS\fP is not set.)
-.I fpath
-¤¬¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ç¡¢Â¸ºß¤·¤Ê¤¤¥Õ¥¡¥¤¥ë¤ò»Ø¤·¤Æ¤¤¤ë
-(¤³¤ì¤¬¥»¥Ã¥È¤µ¤ì¤ë¤Î¤Ï
-.B FTW_PHYS
-¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤À¤±¤Ç¤¢¤ë)¡£
+\fIfpath\fP がシンボリックリンクで、かつ \fBFTW_PHYS\fP が \fIflags\fP に セットされていた。
+.TP 
+\fBFTW_SLN\fP
+\fIfpath\fP がシンボリックリンクで、存在しないファイルを指している (これがセットされるのは \fBFTW_PHYS\fP
+がセットされていない場合だけである)。
 .LP
-.\"O The fourth argument that
-.\"O .BR nftw ()
-.\"O supplies when calling
-.\"O \fIfn\fP()
-.\"O is a structure of type \fIFTW\fP:
-.BR nftw ()
-¤¬
-.IR fn ()
-¤ò¸Æ¤Ó½Ð¤¹ºÝ¤ËÅϤ¹ 4¤Ä¤á¤Î°ú¤­¿ô¤Ï
-.I FTW
-·¿¤Î¹½Â¤ÂΤǤ¢¤ë¡£
+\fBnftw\fP()  が \fIfn\fP()  を呼び出す際に渡す 4つめの引き数は \fIFTW\fP 型の構造体である。
 .in +4n
 .nf
 
@@ -519,158 +192,40 @@ struct FTW {
 
 .fi
 .in
-.\"O .I base
-.\"O is the offset of the filename (i.e., basename component)
-.\"O in the pathname given in
-.\"O .IR fpath .
-.\"O .I level
-.\"O is the depth of
-.\"O .I fpath
-.\"O in the directory tree, relative to the root of the tree
-.\"O .RI ( dirpath ,
-.\"O which has depth 0).
-.I base
-¤Ï¡¢¥Õ¥¡¥¤¥ë̾ (basename Í×ÁÇ) ¤Î¡¢
-.I fpath
-¤ÇÅϤµ¤ì¤ë¥Ñ¥¹Ì¾¤ÎÃæ¤Ç¤Î¥ª¥Õ¥»¥Ã¥È¤Ç¤¢¤ë¡£
-.I level
-¤Ï¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤Ç¤Î
-.I fpath
-¤Î¿¼¤µ¤ò¼¨¤¹¡£¿¼¤µ¤Ï¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤Î¥È¥Ã¥× (root) ¤«¤é¤Î
-ÁêÂÐÃͤǤ¢¤ë
-.RI ( dirpath
-¤Ï¿¼¤µ 0 ¤Ç¤¢¤ë)¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O These functions return 0 on success, and \-1 if an error occurs.
-¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢À®¸ù¤¹¤ë¤È 0 ¤ò¡¢¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È \-1 ¤òÊÖ¤¹¡£
+\fIbase\fP は、ファイル名 (basename 要素) の、 \fIfpath\fP で渡されるパス名の中でのオフセットである。 \fIlevel\fP
+はディレクトリツリーでの \fIfpath\fP の深さを示す。深さはディレクトリツリーのトップ (root) からの 相対値である (\fIdirpath\fP
+は深さ 0 である)。
+.SH 返り値
+これらの関数は、成功すると 0 を、エラーが発生すると \-1 を返す。
 
-.\"O If \fIfn\fP() returns nonzero,
-.\"O then the tree walk is terminated and the value returned by \fIfn\fP()
-.\"O is returned as the result of \fBftw\fP() or
-.\"O .BR nftw ().
-.IR fn ()
-¤¬ 0 °Ê³°¤òÊÖ¤·¤¿¾ì¹ç¡¢¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤Îõº÷¤ò½ªÎ»¤·¡¢
-.IR fn ()
-¤¬ÊÖ¤·¤¿Ãͤò
-.BR ftw ()
-¤ä
-.BR nftw ()
-¤Î·ë²Ì¤È¤·¤ÆÊÖ¤¹¡£
+\fIfn\fP()  が 0 以外を返した場合、ディレクトリツリーの探索を終了し、 \fIfn\fP()  が返した値を \fBftw\fP()  や
+\fBnftw\fP()  の結果として返す。
 
-.\"O If
-.\"O .BR nftw ()
-.\"O is called with the \fBFTW_ACTIONRETVAL\fP flag,
-.\"O then the only nonzero value that should be used by \fIfn\fP()
-.\"O to terminate the tree walk is \fBFTW_STOP\fP,
-.\"O and that value is returned as the result of
-.\"O .BR nftw ().
-.BR nftw ()
-¤¬
-.B FTW_ACTIONRETVAL
-¥Õ¥é¥°ÉÕ¤­¤Ç¸Æ¤Ð¤ì¤¿¾ì¹ç¡¢¥Ä¥ê¡¼¤Îõº÷¤ò½ªÎ»¤µ¤»¤ë¤¿¤á¤Ë
-.IR fn ()
-¤¬»ÈÍѤǤ­¤ë¡¢Èó 0 ¤ÎÃͤÏ
-.B FTW_STOP
-¤À¤±¤Ç¤¢¤ê¡¢
-¤³¤ÎÃͤÏ
-.BR nftw ()
-¤ÎÊÖ¤êÃͤȤ·¤ÆÊÖ¤µ¤ì¤ë¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-POSIX.1-2001, SVr4, SUSv1.
-.\"O POSIX.1-2008 marks
-.\"O .BR ftw ()
-.\"O as obsolete.
-POSIX.1-2008 ¤Ï
-.BR ftw ()
-¤òÇÑ»ßͽÄê¤È¤·¤Æ¤¤¤ë¡£
-.\"O .SH NOTES
-.SH Ãí°Õ
-.\"O POSIX.1-2001 note that the results are unspecified if
-.\"O .I fn
-.\"O does not preserve the current working directory.
-POSIX.1-2001 ¤ÎÃíµ­¤Ë¤è¤ë¤È¡¢
-.I fn
-¤¬¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤òÊÝ»ý¤·¤Ê¤«¤Ã¤¿¾ì¹ç¤Î
-·ë²Ì¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¤È¤µ¤ì¤Æ¤¤¤ë¡£
+\fBnftw\fP()  が \fBFTW_ACTIONRETVAL\fP フラグ付きで呼ばれた場合、ツリーの探索を終了させるために \fIfn\fP()
+が使用できる、非 0 の値は \fBFTW_STOP\fP だけであり、 この値は \fBnftw\fP()  の返り値として返される。
+.SH 準拠
+POSIX.1\-2001, SVr4, SUSv1.  POSIX.1\-2008 は \fBftw\fP()  を廃止予定としている。
+.SH 注意
+POSIX.1\-2001 の注記によると、 \fIfn\fP がカレントワーキングディレクトリを保持しなかった場合の 結果は規定されていないとされている。
 .PP
-.\"O The function
-.\"O .BR nftw ()
-.\"O and the use of \fBFTW_SL\fP with
-.\"O .BR ftw ()
-.\"O were introduced in SUSv1.
-.BR nftw ()
-´Ø¿ô¤È¡¢
-.BR ftw ()
-¤Ë¤ª¤±¤ë
-.B FTW_SL
-¤Ï¡¢SUSv1 ¤ÇƳÆþ¤µ¤ì¤¿¡£
+\fBnftw\fP()  関数と、 \fBftw\fP()  における \fBFTW_SL\fP は、SUSv1 で導入された。
 .LP
-.\"O On some systems
-.\"O .BR ftw ()
-.\"O will never use \fBFTW_SL\fP, on other systems \fBFTW_SL\fP occurs only
-.\"O for symbolic links that do not point to an existing file,
-.\"O and again on other systems
-.\"O .BR ftw ()
-.\"O will use \fBFTW_SL\fP for each symbolic link.
-.\"O For predictable control, use
-.\"O .BR nftw ().
-.BR ftw ()
-¤Ç
-.B FTW_SL
-¤ò°ìÀڻȤï¤Ê¤¤¥·¥¹¥Æ¥à¤ä¡¢
-¸ºß¤·¤Ê¤¤¥Õ¥¡¥¤¥ë¤ò»Ø¤·¤Æ¤¤¤ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î¾ì¹ç¤Ë¤Î¤ß
-.B FTW_SL
-¤ò»È¤¦¥·¥¹¥Æ¥à¡¢¤Þ¤¿
-.BR ftw ()
-¤¬Á´¤Æ¤Î¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ËÂФ·¤Æ
-.B FTW_SL
-¤ò»È¤¦¥·¥¹¥Æ¥à¤â¤¢¤ë¡£
-ͽ¬²Äǽ¤ÊÆ°ºî¤ò¤µ¤»¤ë¤¿¤á¤Ë¤Ï¡¢
-.BR nftw ()
-¤ò»È¤¦¤³¤È¡£
+\fBftw\fP()  で \fBFTW_SL\fP を一切使わないシステムや、 存在しないファイルを指しているシンボリックリンクの場合にのみ \fBFTW_SL\fP
+を使うシステム、また \fBftw\fP()  が全てのシンボリックリンクに対して \fBFTW_SL\fP を使うシステムもある。
+予測可能な動作をさせるためには、 \fBnftw\fP()  を使うこと。
 .LP
-.\"O Under Linux, libc4 and libc5 and glibc 2.0.6 will
-.\"O use \fBFTW_F\fP for all objects (files, symbolic links, FIFOs, etc.)
-.\"O that can be stat'ed but are not a directory.
-Linux ¤Ç¤Ï¡¢ libc4, libc5, glibc 2.0.6 ¤Ï
-¡Östat ¤Ç¤­¤ë¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ï¤Ê¤¤¥ª¥Ö¥¸¥§¥¯¥È¡×
-(¥Õ¥¡¥¤¥ë, ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯, fifo Åù)
-¤ËÂФ·¤Æ¤Ï¤¹¤Ù¤Æ
-.B FTW_F
-¤ò»È¤¦¡£
+Linux では、 libc4, libc5, glibc 2.0.6 は 「stat できるがディレクトリではないオブジェクト」 (ファイル,
+シンボリックリンク, fifo 等)  に対してはすべて \fBFTW_F\fP を使う。
 
-.\"O The function
-.\"O .BR nftw ()
-.\"O is available since glibc 2.1.
-.BR nftw ()
-´Ø¿ô¤Ï glibc 2.1 °Ê¹ß¤ÇÍøÍѤǤ­¤ë¡£
+\fBnftw\fP()  関数は glibc 2.1 以降で利用できる。
 
-.\"O \fBFTW_ACTIONRETVAL\fP is glibc-specific.
-.B FTW_ACTIONRETVAL
-¤Ï glibc ¸ÇÍ­¤Ç¤¢¤ë¡£
-.\"O .SH EXAMPLE
-.SH Îã
-.\"O The following program traverses the directory tree under the path named
-.\"O in its first command-line argument, or under the current directory
-.\"O if no argument is supplied.
-.\"O It displays various information about each file.
-.\"O The second command-line argument can be used to specify characters that
-.\"O control the value assigned to the \fIflags\fP
-.\"O argument when calling
-.\"O .BR nftw ().
-°Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¡¢°ì¤ÄÌܤΥ³¥Þ¥ó¥É¥é¥¤¥ó°ú¤­¿ô¤ò̾Á°¤Ë»ý¤Ä¥Ñ¥¹°Ê²¼¤Î
-¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤òõº÷¤¹¤ë¡£°ú¤­¿ô¤¬»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï¡¢
-¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤òõº÷¤¹¤ë¡£
-³Æ¡¹¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤ÆÍÍ¡¹¤Î¾ðÊó¤¬É½¼¨¤µ¤ì¤ë¡£
-ÆóÈÖÌܤΥ³¥Þ¥ó¥É¥é¥¤¥ó°ú¤­¿ô¤Ëʸ»ú¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¢
-.BR nftw ()
-¤ò¸Æ¤Ó½Ð¤¹ºÝ¤Ë
-.I flags
-°ú¤­¿ô¤ËÅϤ¹ÃͤòÀ©¸æ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
+\fBFTW_ACTIONRETVAL\fP は glibc 固有である。
+.SH 例
+以下のプログラムは、一つ目のコマンドライン引き数を名前に持つパス以下の ディレクトリツリーを探索する。引き数が指定されなかった場合は、
+カレントディレクトリ以下を探索する。 各々のファイルについて様々の情報が表示される。 二番目のコマンドライン引き数に文字を指定することで、
+\fBnftw\fP()  を呼び出す際に \fIflags\fP 引き数に渡す値を制御することができる。
+.SS プログラムのソース
 .nf
-
 #define _XOPEN_SOURCE 500
 #include <ftw.h>
 #include <stdio.h>
@@ -682,7 +237,7 @@ static int
 display_info(const char *fpath, const struct stat *sb,
              int tflag, struct FTW *ftwbuf)
 {
-    printf("%\-3s %2d %7jd   %\-40s %d %s\\n",
+    printf("%\-3s %2d %7jd   %\-40s %d %s\en",
         (tflag == FTW_D) ?   "d"   : (tflag == FTW_DNR) ? "dnr" :
         (tflag == FTW_DP) ?  "dp"  : (tflag == FTW_F) ?   "f" :
         (tflag == FTW_NS) ?  "ns"  : (tflag == FTW_SL) ?  "sl" :
@@ -710,8 +265,9 @@ main(int argc, char *argv[])
     exit(EXIT_SUCCESS);
 }
 .fi
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR stat (2),
-.BR fts (3),
-.BR readdir (3)
+.SH 関連項目
+\fBstat\fP(2), \fBfts\fP(3), \fBreaddir\fP(3)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.64 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。