.\" Copyright (c) 1983, 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. .\" .\" @(#)getfsent.3 8.1 (Berkeley) 6/4/93 .\" .\" $FreeBSD$ .Dd June 4, 1993 .Dt GETFSENT 3 .Os BSD 4 .Sh 名称 .Nm getfsent , .Nm getfsspec , .Nm getfsfile , .Nm setfsent , .Nm endfsent .Nd ファイルシステム記述ファイルのエントリを取得 .Sh 書式 .Fd #include .Ft struct fstab * .Fn getfsent void .Ft struct fstab * .Fn getfsspec "const char *spec" .Ft struct fstab * .Fn getfsfile "const char *file" .Ft int .Fn setfsent void .Ft void .Fn endfsent void .Sh 解説 .Fn getfsent , .Fn getfsspec , および .Fn getfsfile 関数はそれぞれ、次に示す構造体を持つオブジェクトのポインタを返します。 構造体には、ファイルシステム記述ファイル .Aq Pa fstab.h にある行の内訳フィールドが含まれます。 .Bd -literal -offset indent struct fstab { char *fs_spec; /* ブロック特殊デバイス名 */ char *fs_file; /* ファイルシステムのパスプレフィックス */ char *fs_vfstype; /* ファイルシステムのタイプ, ufs, nfs */ char *fs_mntops; /* マウントオプション -o */ char *fs_type; /* fs_mntops からの FSTAB_* */ int fs_freq; /* ダンプ頻度, 昼間 */ int fs_passno; /* パラレル fsck のバス番号 */ }; .Ed .Pp これらのフィールドはそれぞれ、 .Xr fstab 5 に記述された意味を持ちます。 .Pp .Fn setfsent 関数はファイルをオープンします(前にオープンされていたほかのファイルは クローズされます)。または、目的のファイルがすでにオープンされている場 合はリワインドします。 .Pp .Fn endfsent 関数はファイルをクローズします。 .Pp .Fn getfsspec および .Fn getfsfile 関数は、目的のファイルで(必要ならばそれをオープンして)、適合する特殊ファ イル名またはシステムファイル名を検索します。 .Pp データベース全体を読み込むプログラムの場合、 .Fn getfsent は次のエントリを(必要ならば目的のファイルをオープンして)読み込みます。 .Pp .Dv FSTAB_XX と等価のタイプフィールドを持つファイルの、エントリはすべて無視されます。 .Sh 戻り値 .Fn getfsent , .Fn getfsspec , および .Fn getfsfile 関数は、 .Dv EOF またはエラーで .Dv NULL ポインタを返します。 .Fn setfsent 関数は失敗した場合 0を、成功した場合は 1を返します。 .Fn endfsent 関数の戻り値はありません。 .Sh 関連ファイル .Bl -tag -width /etc/fstab -compact .It Pa /etc/fstab .El .Sh 関連項目 .Xr fstab 5 .Sh 歴史 .Fn getfsent 関数は .Bx 4.0 で最初に取り入れられました。 .Fn endfsent , .Fn getfsfile , .Fn getfsspec および .Fn setfsent 関数は .Bx 4.3 で最初に登場しました。 .Sh バグ これらの関数は静的データ記憶域を使用します。データが後で必要になる場合は、 以後の呼び出しで上書きする前に、コピーして保存する必要があります。