xref: /freebsd/lib/libc/gen/strtofflags.3 (revision 25bb73e063c17cd9048cf60100dbc0ac5177e94a)
118c0eeddSJosef Karthauser.\" Copyright (c) 1989, 1991, 1993
218c0eeddSJosef Karthauser.\"	The Regents of the University of California.  All rights reserved.
318c0eeddSJosef Karthauser.\"
418c0eeddSJosef Karthauser.\" Redistribution and use in source and binary forms, with or without
518c0eeddSJosef Karthauser.\" modification, are permitted provided that the following conditions
618c0eeddSJosef Karthauser.\" are met:
718c0eeddSJosef Karthauser.\" 1. Redistributions of source code must retain the above copyright
818c0eeddSJosef Karthauser.\"    notice, this list of conditions and the following disclaimer.
918c0eeddSJosef Karthauser.\" 2. Redistributions in binary form must reproduce the above copyright
1018c0eeddSJosef Karthauser.\"    notice, this list of conditions and the following disclaimer in the
1118c0eeddSJosef Karthauser.\"    documentation and/or other materials provided with the distribution.
1218c0eeddSJosef Karthauser.\" 3. All advertising materials mentioning features or use of this software
1318c0eeddSJosef Karthauser.\"    must display the following acknowledgement:
1418c0eeddSJosef Karthauser.\"	This product includes software developed by the University of
1518c0eeddSJosef Karthauser.\"	California, Berkeley and its contributors.
1618c0eeddSJosef Karthauser.\" 4. Neither the name of the University nor the names of its contributors
1718c0eeddSJosef Karthauser.\"    may be used to endorse or promote products derived from this software
1818c0eeddSJosef Karthauser.\"    without specific prior written permission.
1918c0eeddSJosef Karthauser.\"
2018c0eeddSJosef Karthauser.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2118c0eeddSJosef Karthauser.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2218c0eeddSJosef Karthauser.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2318c0eeddSJosef Karthauser.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2418c0eeddSJosef Karthauser.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2518c0eeddSJosef Karthauser.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2618c0eeddSJosef Karthauser.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2718c0eeddSJosef Karthauser.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2818c0eeddSJosef Karthauser.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2918c0eeddSJosef Karthauser.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3018c0eeddSJosef Karthauser.\" SUCH DAMAGE.
3118c0eeddSJosef Karthauser.\"
3218c0eeddSJosef Karthauser.\"     @(#)setmode.3	8.2 (Berkeley) 4/28/95
3318c0eeddSJosef Karthauser.\" $FreeBSD$
3418c0eeddSJosef Karthauser.\"
3518c0eeddSJosef Karthauser.Dd January 1, 2000
3618c0eeddSJosef Karthauser.Dt SETFLAGS 3
3718c0eeddSJosef Karthauser.Os
3818c0eeddSJosef Karthauser.Sh NAME
3918c0eeddSJosef Karthauser.Nm getflags ,
4018c0eeddSJosef Karthauser.Nm setflags
4118c0eeddSJosef Karthauser.Nd modify file flag bits
4225bb73e0SAlexey Zelkin.Sh LIBRARY
4325bb73e0SAlexey Zelkin.Lb libc
4418c0eeddSJosef Karthauser.Sh SYNOPSIS
4518c0eeddSJosef Karthauser.Fd #include <unistd.h>
4618c0eeddSJosef Karthauser.Ft char *
4718c0eeddSJosef Karthauser.Fn getflags "u_long flags" "char *def"
4818c0eeddSJosef Karthauser.Ft int
4918c0eeddSJosef Karthauser.Fn setflags "char **stringp" "u_long *setp" "u_long *clrp"
5018c0eeddSJosef Karthauser.Sh DESCRIPTION
5118c0eeddSJosef KarthauserThe
5218c0eeddSJosef Karthauser.Fn getflags
5318c0eeddSJosef Karthauserfunction returns a comma separated string of the file flags represented by
5418c0eeddSJosef Karthauser.Fa flags .
5518c0eeddSJosef KarthauserIf no flags are set the string
5618c0eeddSJosef Karthauser.Fa def
5718c0eeddSJosef Karthauseris returned instead.
5818c0eeddSJosef Karthauser.Pp
5918c0eeddSJosef KarthauserThe
6018c0eeddSJosef Karthauser.Fn setflags
6118c0eeddSJosef Karthauserfunction takes a string of file flags, as described in
6218c0eeddSJosef Karthauser.Xr chflags 1 ,
6318c0eeddSJosef Karthauserparses it, and returns the 'set' flags and 'clear' flags
6418c0eeddSJosef Karthausersuch as would be given as arguments to
6518c0eeddSJosef Karthauser.Xr chflags 2 .
6618c0eeddSJosef KarthauserOn success
6718c0eeddSJosef Karthauser.Fn setflags
6818c0eeddSJosef Karthauserreturns 0, otherwise it returns non-zero and
6918c0eeddSJosef Karthauser.Fa stringp
7018c0eeddSJosef Karthauseris left pointing to the offending token.
7118c0eeddSJosef Karthauser.Sh SEE ALSO
7218c0eeddSJosef Karthauser.Xr chflags 1 ,
7318c0eeddSJosef Karthauser.Xr chflags 2 ,
7418c0eeddSJosef Karthauser.Sh HISTORY
7518c0eeddSJosef KarthauserThe
7618c0eeddSJosef Karthauser.Fn getflags
7718c0eeddSJosef Karthauserand
7818c0eeddSJosef Karthauser.Fn setflags
7918c0eeddSJosef Karthauserfunctions first appeared in
8018c0eeddSJosef Karthauser.Fx 4.0 .
81