__ goes away
[unix-history] / usr / src / lib / libc / gen / getfsent.3
CommitLineData
ae59e04c 1.\" Copyright (c) 1983, 1991 The Regents of the University of California.
12568253 2.\" All rights reserved.
2f4571d9 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
12568253 5.\"
ae59e04c 6.\" @(#)getfsent.3 6.9 (Berkeley) %G%
2f4571d9 7.\"
ae59e04c
CL
8.Dd
9.Dt GETFSENT 3
10.Os BSD 4
11.Sh NAME
12.Nm getfsent ,
13.Nm getfsspec ,
14.Nm getfsfile ,
15.Nm setfsent ,
16.Nm endfsent
17.Nd get file system descriptor file entry
18.Sh SYNOPSIS
19.Fd #include <fstab.h>
20.Ft fstab *
21.Fn getfsent void
22.Ft struct fstab *
23.Fn getfsspec "const char *spec"
24.Ft struct fstab *
25.Fn getfsfile "const char *file"
26.Ft int
27.Fn setfsent void
28.Ft void
29.Fn endfsent void
30.Sh DESCRIPTION
31The
32.Fn getfsent ,
33.Fn getfsspec ,
2f4571d9 34and
ae59e04c
CL
35.Fn getfsfile
36functions
55cdef46 37each return a pointer to an object with the following structure
b467b8ca
KB
38containing the broken-out fields of a line in the file system
39description file,
ae59e04c
CL
40.Aq Pa fstab.h .
41.Bd -literal -offset indent
9dbe8c98 42struct fstab {
1e24342d
KM
43 char *fs_spec; /* block special device name */
44 char *fs_file; /* file system path prefix */
45 char *fs_vfstype; /* type of file system */
46 char *fs_mntops; /* comma separated mount options */
47 char *fs_type; /* rw, ro, sw, or xx */
48 int fs_freq; /* dump frequency, in days */
49 int fs_passno; /* pass number on parallel dump */
2f4571d9 50};
ae59e04c
CL
51.Ed
52.Pp
2f4571d9 53The fields have meanings described in
ae59e04c
CL
54.Xr fstab 5 .
55.Pp
56The
57.Fn setfsent
58function
62ab31a2
KB
59opens the file (closing any previously opened file) or rewinds it
60if it is already open.
ae59e04c
CL
61.Pp
62The
63.Fn endfsent
64function
2f4571d9 65closes the file.
ae59e04c
CL
66.Pp
67The
68.Fn getfsspec
2f4571d9 69and
ae59e04c
CL
70.Fn getfsfile
71functions
62ab31a2
KB
72search the entire file (opening it if necessary) for a matching special
73file name or file system file name.
ae59e04c 74.Pp
62ab31a2 75For programs wishing to read the entire database,
ae59e04c 76.Fn getfsent
62ab31a2 77reads the next entry (opening the file if necessary).
ae59e04c 78.Pp
62ab31a2 79All entries in the file with a type field equivalent to
ae59e04c 80.Dv FSTAB_XX
b467b8ca 81are ignored.
ae59e04c
CL
82.Sh RETURN VALUES
83The
84.Fn getfsent ,
85.Fn getfsspec ,
12568253 86and
ae59e04c
CL
87.Fn getfsfile
88functions
89return a null pointer (0) on
90.Dv EOF
91or error.
92The
93.Fn setfsent
94function
62ab31a2 95returns 0 on failure, 1 on success.
ae59e04c
CL
96The
97.Fn endfsent
98function
12568253 99returns nothing.
ae59e04c
CL
100.Sh FILES
101.Bl -tag -width /etc/fstab -compact
102.It Pa /etc/fstab
103.El
104.Sh SEE ALSO
105.Xr fstab 5
106.Sh HISTORY
107The
108.Fn getfsent
109function appeared in
110.Bx 4.0 ;
111the
112.Fn endfsent ,
113.Fn getfsfile ,
114.Fn getfsspec ,
115and
116.Fn setfsent
117functions appeared in
118.Bx 4.3 .
119.Sh BUGS
120These functions use static data storage;
121if the data is needed for future use, it should be
122copied before any subsequent calls overwrite it.