2 * Copyright (c) 2000 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef _OPEN_FLAGS_H_
19 #define _OPEN_FLAGS_H_
21 /***********************************************************************
22 * This function attempts to convert open flag bits into human readable
23 * symbols (i.e. O_TRUNC). If there are more than one symbol,
24 * the <sep> string will be placed as a separator between symbols.
25 * Commonly used separators would be a comma "," or pipe "|".
26 * If <mode> is one and not all <openflags> bits can be converted to
27 * symbols, the "UNKNOWN" symbol will be added to return string.
30 * openflags2symbols will return the indentified symbols.
31 * If no symbols are recognized the return value will be a empty
32 * string or the "UNKNOWN" symbol.
35 * Currently (05/96) all known symbols are coded into openflags2symbols.
36 * If new open flags are added this code will have to updated
37 * to know about them or they will not be recognized.
39 * The Open_symbols must be large enough to hold all possible symbols
42 ***********************************************************************/
43 char *openflags2symbols( int, char *, int );
45 /***********************************************************************
46 * This function will take a string of comma separated open flags symbols
47 * and translate them into an open flag bitmask.
48 * If any symbol is not valid, -1 is returned. On this error condition
49 * the badname pointer is updated if not NULL. badname will point
50 * to the beginning location of where the invalid symbol was found.
51 * string will be returned unchanged.
53 * A signal received while parsing string could cause the string to
54 * contain a NULL character in the middle of it.
56 ***********************************************************************/
57 int parse_open_flags( char *, char ** );