xref: /original-bsd/lib/libc/gen/getfsent.3 (revision 6b005e0a)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)getfsent.3	8.1 (Berkeley) 06/04/93
7.\"
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 ,
34and
35.Fn getfsfile
36functions
37each return a pointer to an object with the following structure
38containing the broken-out fields of a line in the file system
39description file,
40.Aq Pa fstab.h .
41.Bd -literal -offset indent
42struct fstab {
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 */
50};
51.Ed
52.Pp
53The fields have meanings described in
54.Xr fstab 5 .
55.Pp
56The
57.Fn setfsent
58function
59opens the file (closing any previously opened file) or rewinds it
60if it is already open.
61.Pp
62The
63.Fn endfsent
64function
65closes the file.
66.Pp
67The
68.Fn getfsspec
69and
70.Fn getfsfile
71functions
72search the entire file (opening it if necessary) for a matching special
73file name or file system file name.
74.Pp
75For programs wishing to read the entire database,
76.Fn getfsent
77reads the next entry (opening the file if necessary).
78.Pp
79All entries in the file with a type field equivalent to
80.Dv FSTAB_XX
81are ignored.
82.Sh RETURN VALUES
83The
84.Fn getfsent ,
85.Fn getfsspec ,
86and
87.Fn getfsfile
88functions
89return a null pointer (0) on
90.Dv EOF
91or error.
92The
93.Fn setfsent
94function
95returns 0 on failure, 1 on success.
96The
97.Fn endfsent
98function
99returns nothing.
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.
123