Xinu7/man/man3/ckmode.doc
CKMODE(3) Xinu Programmer's Manual CKMODE(3)
NAME
ckmode - check a file mode string and convert to integer
representation
SYNOPSIS
#include <file.h>
int chmode(mode)
char *mode;
DESCRIPTION
_C_k_m_o_d_e parses a null-terminated string, _m_o_d_e, containing
characters that represent file modes, and produces an
integer with mode bits set. The possible mode characters
are:
r The file is to be opened for reading (i.e., input).
w The file is to be opened for writing (i.e., output).
n The file must be new. That is, it must not already
exist.
o The file must be old. That is, it must already exist.
The file mode string, _m_o_d_e, can specify that the file is to
be accessed for both reading and writing, but it cannot
specify the mode to be both old and new. If neither reading
nor writing is specified, _c_k_m_o_d_e assumes the file will be
used for both. Similarly, if neither old or new files are
specified, _c_k_m_o_d_e assumes either is allowed.
Given a legal mode string, _c_k_m_o_d_e returns an integer with
bits _F_L_R_E_A_D, FLWRITE, FLOLD, and FLNEW set according to the
argument, _m_o_d_e. _C_k_m_o_d_e returns SYSERR if it finds illegal
or duplicated characters in the argument string, or if the
mode string specifies that the file must be both old and
new.
Version 6b Printed 1/12/87 1