xref: /csrg-svn/lib/libc/gen/getfsent.3 (revision 61111)
1*61111Sbostic.\" Copyright (c) 1983, 1991, 1993
2*61111Sbostic.\"	The Regents of the University of California.  All rights reserved.
320425Smckusick.\"
443571Strent.\" %sccs.include.redist.man%
520425Smckusick.\"
6*61111Sbostic.\"     @(#)getfsent.3	8.1 (Berkeley) 06/04/93
735516Sbostic.\"
848352Scael.Dd
948352Scael.Dt GETFSENT 3
1048352Scael.Os BSD 4
1148352Scael.Sh NAME
1248352Scael.Nm getfsent ,
1348352Scael.Nm getfsspec ,
1448352Scael.Nm getfsfile ,
1548352Scael.Nm setfsent ,
1648352Scael.Nm endfsent
1748352Scael.Nd get file system descriptor file entry
1848352Scael.Sh SYNOPSIS
1948352Scael.Fd #include <fstab.h>
2048352Scael.Ft fstab *
2148352Scael.Fn getfsent void
2248352Scael.Ft struct fstab *
2348352Scael.Fn getfsspec "const char *spec"
2448352Scael.Ft struct fstab *
2548352Scael.Fn getfsfile "const char *file"
2648352Scael.Ft int
2748352Scael.Fn setfsent void
2848352Scael.Ft void
2948352Scael.Fn endfsent void
3048352Scael.Sh DESCRIPTION
3148352ScaelThe
3248352Scael.Fn getfsent ,
3348352Scael.Fn getfsspec ,
3420425Smckusickand
3548352Scael.Fn getfsfile
3648352Scaelfunctions
3720426Smckusickeach return a pointer to an object with the following structure
3835371Sbosticcontaining the broken-out fields of a line in the file system
3935371Sbosticdescription file,
4048352Scael.Aq Pa fstab.h .
4148352Scael.Bd -literal -offset indent
4228031Skarelsstruct fstab {
4338672Smckusick	char	*fs_spec;	/* block special device name */
4438672Smckusick	char	*fs_file;	/* file system path prefix */
4538672Smckusick	char	*fs_vfstype;	/* type of file system */
4638672Smckusick	char	*fs_mntops;	/* comma separated mount options */
4738672Smckusick	char	*fs_type;	/* rw, ro, sw, or xx */
4838672Smckusick	int	fs_freq;	/* dump frequency, in days */
4938672Smckusick	int	fs_passno;	/* pass number on parallel dump */
5020425Smckusick};
5148352Scael.Ed
5248352Scael.Pp
5320425SmckusickThe fields have meanings described in
5448352Scael.Xr fstab 5 .
5548352Scael.Pp
5648352ScaelThe
5748352Scael.Fn setfsent
5848352Scaelfunction
5935521Sbosticopens the file (closing any previously opened file) or rewinds it
6035521Sbosticif it is already open.
6148352Scael.Pp
6248352ScaelThe
6348352Scael.Fn endfsent
6448352Scaelfunction
6520425Smckusickcloses the file.
6648352Scael.Pp
6748352ScaelThe
6848352Scael.Fn getfsspec
6920425Smckusickand
7048352Scael.Fn getfsfile
7148352Scaelfunctions
7235521Sbosticsearch the entire file (opening it if necessary) for a matching special
7335521Sbosticfile name or file system file name.
7448352Scael.Pp
7535521SbosticFor programs wishing to read the entire database,
7648352Scael.Fn getfsent
7735521Sbosticreads the next entry (opening the file if necessary).
7848352Scael.Pp
7935521SbosticAll entries in the file with a type field equivalent to
8048352Scael.Dv FSTAB_XX
8135371Sbosticare ignored.
8248352Scael.Sh RETURN VALUES
8348352ScaelThe
8448352Scael.Fn getfsent ,
8548352Scael.Fn getfsspec ,
8635516Sbosticand
8748352Scael.Fn getfsfile
8848352Scaelfunctions
8948352Scaelreturn a null pointer (0) on
9048352Scael.Dv EOF
9148352Scaelor error.
9248352ScaelThe
9348352Scael.Fn setfsent
9448352Scaelfunction
9535521Sbosticreturns 0 on failure, 1 on success.
9648352ScaelThe
9748352Scael.Fn endfsent
9848352Scaelfunction
9935516Sbosticreturns nothing.
10048352Scael.Sh FILES
10148352Scael.Bl -tag -width /etc/fstab -compact
10248352Scael.It Pa /etc/fstab
10348352Scael.El
10448352Scael.Sh SEE ALSO
10548352Scael.Xr fstab 5
10648352Scael.Sh HISTORY
10748352ScaelThe
10848352Scael.Fn getfsent
10948352Scaelfunction appeared in
11048352Scael.Bx 4.0 ;
11148352Scaelthe
11248352Scael.Fn endfsent ,
11348352Scael.Fn getfsfile ,
11448352Scael.Fn getfsspec ,
11548352Scaeland
11648352Scael.Fn setfsent
11748352Scaelfunctions appeared in
11848352Scael.Bx 4.3 .
11948352Scael.Sh BUGS
12048352ScaelThese functions use static data storage;
12148352Scaelif the data is needed for future use, it should be
12248352Scaelcopied before any subsequent calls overwrite it.
123