Commit | Line | Data |
---|---|---|
8168e750 WJ |
1 | .\" Copyright (c) 1983, 1991 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
19 | .\" | |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" @(#)getfsent.3 6.9 (Berkeley) 4/19/91 | |
33 | .\" | |
34 | .Dd April 19, 1991 | |
35 | .Dt GETFSENT 3 | |
36 | .Os BSD 4 | |
37 | .Sh NAME | |
38 | .Nm getfsent , | |
39 | .Nm getfsspec , | |
40 | .Nm getfsfile , | |
41 | .Nm setfsent , | |
42 | .Nm endfsent | |
43 | .Nd get file system descriptor file entry | |
44 | .Sh SYNOPSIS | |
45 | .Fd #include <fstab.h> | |
46 | .Ft fstab * | |
47 | .Fn getfsent void | |
48 | .Ft struct fstab * | |
49 | .Fn getfsspec "const char *spec" | |
50 | .Ft struct fstab * | |
51 | .Fn getfsfile "const char *file" | |
52 | .Ft int | |
53 | .Fn setfsent void | |
54 | .Ft void | |
55 | .Fn endfsent void | |
56 | .Sh DESCRIPTION | |
57 | The | |
58 | .Fn getfsent , | |
59 | .Fn getfsspec , | |
60 | and | |
61 | .Fn getfsfile | |
62 | functions | |
63 | each return a pointer to an object with the following structure | |
64 | containing the broken-out fields of a line in the file system | |
65 | description file, | |
66 | .Aq Pa fstab.h . | |
67 | .Bd -literal -offset indent | |
68 | struct fstab { | |
69 | char *fs_spec; /* block special device name */ | |
70 | char *fs_file; /* file system path prefix */ | |
71 | char *fs_vfstype; /* type of file system */ | |
72 | char *fs_mntops; /* comma separated mount options */ | |
73 | char *fs_type; /* rw, ro, sw, or xx */ | |
74 | int fs_freq; /* dump frequency, in days */ | |
75 | int fs_passno; /* pass number on parallel dump */ | |
76 | }; | |
77 | .Ed | |
78 | .Pp | |
79 | The fields have meanings described in | |
80 | .Xr fstab 5 . | |
81 | .Pp | |
82 | The | |
83 | .Fn setfsent | |
84 | function | |
85 | opens the file (closing any previously opened file) or rewinds it | |
86 | if it is already open. | |
87 | .Pp | |
88 | The | |
89 | .Fn endfsent | |
90 | function | |
91 | closes the file. | |
92 | .Pp | |
93 | The | |
94 | .Fn getfsspec | |
95 | and | |
96 | .Fn getfsfile | |
97 | functions | |
98 | search the entire file (opening it if necessary) for a matching special | |
99 | file name or file system file name. | |
100 | .Pp | |
101 | For programs wishing to read the entire database, | |
102 | .Fn getfsent | |
103 | reads the next entry (opening the file if necessary). | |
104 | .Pp | |
105 | All entries in the file with a type field equivalent to | |
106 | .Dv FSTAB_XX | |
107 | are ignored. | |
108 | .Sh RETURN VALUES | |
109 | The | |
110 | .Fn getfsent , | |
111 | .Fn getfsspec , | |
112 | and | |
113 | .Fn getfsfile | |
114 | functions | |
115 | return a null pointer (0) on | |
116 | .Dv EOF | |
117 | or error. | |
118 | The | |
119 | .Fn setfsent | |
120 | function | |
121 | returns 0 on failure, 1 on success. | |
122 | The | |
123 | .Fn endfsent | |
124 | function | |
125 | returns nothing. | |
126 | .Sh FILES | |
127 | .Bl -tag -width /etc/fstab -compact | |
128 | .It Pa /etc/fstab | |
129 | .El | |
130 | .Sh SEE ALSO | |
131 | .Xr fstab 5 | |
132 | .Sh HISTORY | |
133 | The | |
134 | .Fn getfsent | |
135 | function appeared in | |
136 | .Bx 4.0 ; | |
137 | the | |
138 | .Fn endfsent , | |
139 | .Fn getfsfile , | |
140 | .Fn getfsspec , | |
141 | and | |
142 | .Fn setfsent | |
143 | functions appeared in | |
144 | .Bx 4.3 . | |
145 | .Sh BUGS | |
146 | These functions use static data storage; | |
147 | if the data is needed for future use, it should be | |
148 | copied before any subsequent calls overwrite it. |