Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ckmode(3) — Purdue Xinu

Media Vault

Software Library

Restoration Projects

Artifacts Sought

CKMODE(3)

NAME

ckmode − check a file mode string and convert to integer representation

SYNOPSIS

#include <file.h>

int chmode(mode)
char ∗mode;

DESCRIPTION

Ckmode parses a null-terminated string, mode, 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, mode, 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, ckmode assumes the file will be used for both.  Similarly, if neither old or new files are specified, ckmode assumes either is allowed. 

Given a legal mode string, ckmode returns an integer with bits FLREAD, FLWRITE, FLOLD, and FLNEW set according to the argument, mode.  Ckmode 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. 

December 01, 1986  —  Xinu Programmer’s Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026