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