2000-01-27 21:17:01 +00:00
|
|
|
.\" Copyright (c) 1989, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2017-02-28 23:42:47 +00:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
2000-01-27 21:17:01 +00:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" @(#)setmode.3 8.2 (Berkeley) 4/28/95
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.Dd January 1, 2000
|
2000-06-17 01:28:13 +00:00
|
|
|
.Dt STRTOFFLAGS 3
|
2000-01-27 21:17:01 +00:00
|
|
|
.Os
|
|
|
|
.Sh NAME
|
2000-06-17 01:28:13 +00:00
|
|
|
.Nm fflagstostr ,
|
|
|
|
.Nm strtofflags
|
2000-06-17 11:09:24 +00:00
|
|
|
.Nd convert between file flag bits and their string names
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
2000-01-27 21:17:01 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In unistd.h
|
2000-01-27 21:17:01 +00:00
|
|
|
.Ft char *
|
2000-06-17 01:43:56 +00:00
|
|
|
.Fn fflagstostr "u_long flags"
|
2000-01-27 21:17:01 +00:00
|
|
|
.Ft int
|
2000-06-17 01:28:13 +00:00
|
|
|
.Fn strtofflags "char **stringp" "u_long *setp" "u_long *clrp"
|
2000-01-27 21:17:01 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2000-06-17 01:28:13 +00:00
|
|
|
.Fn fflagstostr
|
2000-01-27 21:17:01 +00:00
|
|
|
function returns a comma separated string of the file flags represented by
|
|
|
|
.Fa flags .
|
2000-06-17 01:43:56 +00:00
|
|
|
If no flags are set a zero length string is returned.
|
2000-01-27 21:17:01 +00:00
|
|
|
.Pp
|
2000-06-17 11:09:24 +00:00
|
|
|
If memory cannot be allocated for the return value,
|
|
|
|
.Fn fflagstostr
|
|
|
|
returns
|
2000-10-30 13:23:19 +00:00
|
|
|
.Dv NULL .
|
2000-06-17 11:09:24 +00:00
|
|
|
.Pp
|
2000-10-30 13:23:19 +00:00
|
|
|
The value returned from
|
2000-06-17 11:09:24 +00:00
|
|
|
.Fn fflagstostr
|
2000-10-30 13:23:19 +00:00
|
|
|
is obtained from
|
|
|
|
.Fn malloc
|
2000-06-17 11:09:24 +00:00
|
|
|
and should be returned to the system with
|
2000-10-30 13:23:19 +00:00
|
|
|
.Fn free
|
2000-06-17 11:09:24 +00:00
|
|
|
when the program is done with it.
|
|
|
|
.Pp
|
2000-01-27 21:17:01 +00:00
|
|
|
The
|
2000-06-17 01:28:13 +00:00
|
|
|
.Fn strtofflags
|
2000-01-27 21:17:01 +00:00
|
|
|
function takes a string of file flags, as described in
|
|
|
|
.Xr chflags 1 ,
|
|
|
|
parses it, and returns the 'set' flags and 'clear' flags
|
|
|
|
such as would be given as arguments to
|
|
|
|
.Xr chflags 2 .
|
|
|
|
On success
|
2000-06-17 01:28:13 +00:00
|
|
|
.Fn strtofflags
|
2000-01-27 21:17:01 +00:00
|
|
|
returns 0, otherwise it returns non-zero and
|
|
|
|
.Fa stringp
|
|
|
|
is left pointing to the offending token.
|
2000-06-17 11:09:24 +00:00
|
|
|
.Sh ERRORS
|
|
|
|
The
|
|
|
|
.Fn fflagstostr
|
|
|
|
function
|
|
|
|
may fail and set errno for any of the errors specified for the library
|
|
|
|
routine
|
|
|
|
.Xr malloc 3 .
|
2000-01-27 21:17:01 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr chflags 1 ,
|
|
|
|
.Xr chflags 2 ,
|
2000-06-17 11:09:24 +00:00
|
|
|
.Xr malloc 3
|
2000-01-27 21:17:01 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
2000-06-17 01:28:13 +00:00
|
|
|
.Fn fflagstostr
|
2000-06-17 11:09:24 +00:00
|
|
|
and
|
|
|
|
.Fn strtofflags
|
2000-01-27 21:17:01 +00:00
|
|
|
functions first appeared in
|
|
|
|
.Fx 4.0 .
|