Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
      3  *
      4  * This program is free software; you can redistribute it and/or modify it
      5  * under the terms of version 2 of the GNU General Public License as
      6  * published by the Free Software Foundation.
      7  *
      8  * This program is distributed in the hope that it would be useful, but
      9  * WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     11  *
     12  * Further, this software is distributed without any warranty that it is
     13  * free of the rightful claim of any third person regarding infringement
     14  * or the like.  Any license provided herein, whether implied or
     15  * otherwise, applies only to this software file.  Patent licenses, if
     16  * any, provided herein do not apply to combinations of this program with
     17  * other software, or any other product whatsoever.
     18  *
     19  * You should have received a copy of the GNU General Public License along
     20  * with this program; if not, write the Free Software Foundation, Inc.,
     21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     22  *
     23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
     24  * Mountain View, CA  94043, or:
     25  *
     26  * http://www.sgi.com
     27  *
     28  * For further information regarding this notice, see:
     29  *
     30  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
     31  */
     32 #ifndef _OPEN_FLAGS_H_
     33 #define _OPEN_FLAGS_H_
     34 
     35 /***********************************************************************
     36  * This function attempts to convert open flag bits into human readable
     37  * symbols (i.e. O_TRUNC).  If there are more than one symbol,
     38  * the <sep> string will be placed as a separator between symbols.
     39  * Commonly used separators would be a comma "," or pipe "|".
     40  * If <mode> is one and not all <openflags> bits can be converted to
     41  * symbols, the "UNKNOWN" symbol will be added to return string.
     42  *
     43  * Return Value
     44  * openflags2symbols will return the indentified symbols.
     45  * If no symbols are recognized the return value will be a empty
     46  * string or the "UNKNOWN" symbol.
     47  *
     48  * Limitations
     49  * Currently (05/96) all known symbols are coded into openflags2symbols.
     50  * If new open flags are added this code will have to updated
     51  * to know about them or they will not be recognized.
     52  *
     53  * The Open_symbols must be large enough to hold all possible symbols
     54  * for a given system.
     55  *
     56  ***********************************************************************/
     57 char *openflags2symbols( int, char *, int );
     58 
     59 /***********************************************************************
     60  * This function will take a string of comma separated open flags symbols
     61  * and translate them into an open flag bitmask.
     62  * If any symbol is not valid, -1 is returned.  On this error condition
     63  * the badname pointer is updated if not NULL.  badname will point
     64  * to the beginning location of where the invalid symbol was found.
     65  * string will be returned unchanged.
     66  *
     67  * A signal received while parsing string could cause the string to
     68  * contain a NULL character in the middle of it.
     69  *
     70  ***********************************************************************/
     71 int parse_open_flags( char *, char ** );
     72 
     73 #endif
     74