parse_open_flags - converts open flag symbols into bitmask
openflags2symbols - converts open flag bitmask into symbols
SYNOPSIS
int
parse_open_flags(symbols, badname)
char *symbols;
char **badname;
char *
openflags2symbols(openflags, sep, mode)
int openflags;
char *sep;
int mode;
DESCRIPTION
The parse_open_flags function can be used to convert
a list of comma separated open(2) flag symbols (i.e. O_TRUNC)
into the bitmask that can be used by open(2) .
If a symbol is unknown and badname is not NULL, badname
will updated to point that symbol in symbols.
Parse_open_flags will return -1 on this error.
Otherwise parse_open_flags will return the open flag bitmask.
If parse_open_flags returns, string will left unchanged.
The openflags2symbols function attempts to convert open flag
bits into human readable symbols (i.e. O_TRUNC). If there
are more than one symbol, the sep string will be placed as
a separator between symbols. Commonly used separators would
be a comma "," or pipe "|". If mode is one and not all
openflags bits can be converted to symbols, the UNKNOWN
symbol will be added to return string.
Openflags2symbols will return the identified symbols.
If no symbols are recognized the return value will be a empty
string or the UNKNOWN symbol.
If the O_WRONLY and O_RDWR bits are not set, openflags2symbols
assumes that O_RDONLY symbol is wanted.
Currently (06/96) all known symbols are coded into openflags2symbols.
If new open flags are added this function code will have to updated
to know about them or they will not be recognized.
The static space where openflags2symbols stores open flag
symbols with callers separators is limited to 512 characters.
This should be large enough for most open flags symbols as long as the
separator is kept short.