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. 12*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 1318c0eeddSJosef Karthauser.\" may be used to endorse or promote products derived from this software 1418c0eeddSJosef Karthauser.\" without specific prior written permission. 1518c0eeddSJosef Karthauser.\" 1618c0eeddSJosef Karthauser.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1718c0eeddSJosef Karthauser.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1818c0eeddSJosef Karthauser.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1918c0eeddSJosef Karthauser.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2018c0eeddSJosef Karthauser.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2118c0eeddSJosef Karthauser.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2218c0eeddSJosef Karthauser.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2318c0eeddSJosef Karthauser.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2418c0eeddSJosef Karthauser.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2518c0eeddSJosef Karthauser.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2618c0eeddSJosef Karthauser.\" SUCH DAMAGE. 2718c0eeddSJosef Karthauser.\" 2818c0eeddSJosef Karthauser.Dd January 1, 2000 29b81eeaf0SJosef Karthauser.Dt STRTOFFLAGS 3 3018c0eeddSJosef Karthauser.Os 3118c0eeddSJosef Karthauser.Sh NAME 32b81eeaf0SJosef Karthauser.Nm fflagstostr , 33b81eeaf0SJosef Karthauser.Nm strtofflags 348c7bdc13SJosef Karthauser.Nd convert between file flag bits and their string names 3525bb73e0SAlexey Zelkin.Sh LIBRARY 3625bb73e0SAlexey Zelkin.Lb libc 3718c0eeddSJosef Karthauser.Sh SYNOPSIS 3832eef9aeSRuslan Ermilov.In unistd.h 3918c0eeddSJosef Karthauser.Ft char * 40d502d9acSJosef Karthauser.Fn fflagstostr "u_long flags" 4118c0eeddSJosef Karthauser.Ft int 42b81eeaf0SJosef Karthauser.Fn strtofflags "char **stringp" "u_long *setp" "u_long *clrp" 4318c0eeddSJosef Karthauser.Sh DESCRIPTION 4418c0eeddSJosef KarthauserThe 45b81eeaf0SJosef Karthauser.Fn fflagstostr 4618c0eeddSJosef Karthauserfunction returns a comma separated string of the file flags represented by 4718c0eeddSJosef Karthauser.Fa flags . 48d502d9acSJosef KarthauserIf no flags are set a zero length string is returned. 4918c0eeddSJosef Karthauser.Pp 508c7bdc13SJosef KarthauserIf memory cannot be allocated for the return value, 518c7bdc13SJosef Karthauser.Fn fflagstostr 528c7bdc13SJosef Karthauserreturns 538c7bdc13SJosef Karthauser.Dv NULL . 548c7bdc13SJosef Karthauser.Pp 558c7bdc13SJosef KarthauserThe value returned from 568c7bdc13SJosef Karthauser.Fn fflagstostr 578c7bdc13SJosef Karthauseris obtained from 588c7bdc13SJosef Karthauser.Fn malloc 598c7bdc13SJosef Karthauserand should be returned to the system with 608c7bdc13SJosef Karthauser.Fn free 618c7bdc13SJosef Karthauserwhen the program is done with it. 628c7bdc13SJosef Karthauser.Pp 6318c0eeddSJosef KarthauserThe 64b81eeaf0SJosef Karthauser.Fn strtofflags 6518c0eeddSJosef Karthauserfunction takes a string of file flags, as described in 6618c0eeddSJosef Karthauser.Xr chflags 1 , 6718c0eeddSJosef Karthauserparses it, and returns the 'set' flags and 'clear' flags 6818c0eeddSJosef Karthausersuch as would be given as arguments to 6918c0eeddSJosef Karthauser.Xr chflags 2 . 7018c0eeddSJosef KarthauserOn success 71b81eeaf0SJosef Karthauser.Fn strtofflags 7218c0eeddSJosef Karthauserreturns 0, otherwise it returns non-zero and 7318c0eeddSJosef Karthauser.Fa stringp 7418c0eeddSJosef Karthauseris left pointing to the offending token. 758c7bdc13SJosef Karthauser.Sh ERRORS 768c7bdc13SJosef KarthauserThe 778c7bdc13SJosef Karthauser.Fn fflagstostr 788c7bdc13SJosef Karthauserfunction 798c7bdc13SJosef Karthausermay fail and set errno for any of the errors specified for the library 808c7bdc13SJosef Karthauserroutine 818c7bdc13SJosef Karthauser.Xr malloc 3 . 8218c0eeddSJosef Karthauser.Sh SEE ALSO 8318c0eeddSJosef Karthauser.Xr chflags 1 , 8418c0eeddSJosef Karthauser.Xr chflags 2 , 858c7bdc13SJosef Karthauser.Xr malloc 3 8618c0eeddSJosef Karthauser.Sh HISTORY 8718c0eeddSJosef KarthauserThe 88b81eeaf0SJosef Karthauser.Fn fflagstostr 898c7bdc13SJosef Karthauserand 908c7bdc13SJosef Karthauser.Fn strtofflags 9118c0eeddSJosef Karthauserfunctions first appeared in 9218c0eeddSJosef Karthauser.Fx 4.0 . 93