BOOTSTRAP (kutils) functions
LIBRARY ROUTINE
kflags_to_type - convert kopen() flags to kfopen() type parameter
LIBRARY CALL
char *kflags_to_type(
int flags,
char *type)
INPUT
OUTPUT
- type - a string to old the kfopen type field. If NULL then
space is malloc'ed
RETURN VALUE
type is returned if it is not NULL. Otherwise the malloc'ed
string is returned. NULL is returned on an error.
DESCRIPTION
The kflags_to_type() routine is used to convert the
flags used in the kopen() call into their corresponding
equivalent in the type field of the kfopen() call.
The "flags" parameter is converted and stored into the
"type" parameter. If the "type" parameter is NULL then
space is malloc'ed and returned. The following is an
example of how to use kflags_to_type():
type = kflags_to_type(KOPEN_WRONLY | KOPEN_CREAT | KOPEN_TRUNC, NULL);
the input flags are converted and result returned to
type will be "w".
Here is the table as it translates:
a+ = KOPEN_RDWR | KOPEN_APPEND | KOPEN_CREAT
w+ = KOPEN_RDWR | KOPEN_CREAT | KOPEN_TRUNC
r+ = KOPEN_RDWR
a = KOPEN_WRONLY | KOPEN_APPEND | KOPEN_CREAT
w = KOPEN_WRONLY | KOPEN_CREAT | KOPEN_TRUNC
r = KOPEN_RDONLY
ADDITIONAL INFORMATION
none
EXAMPLES
none
SIDE EFFECTS
none
RESTRICTIONS
none
MODIFICATION
none
FILES
$BOOTSTRAP/objects/library/kutils/src/kfile.c
SEE ALSO
kutils(3)
COPYRIGHT
Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.