BOOTSTRAP (kutils) functions
LIBRARY ROUTINE
ktype_to_flags - convert kfopen() type to kopen() flags
LIBRARY CALL
int ktype_to_flags(
const char *type)
INPUT
- type - the kfopen string field.
OUTPUT
none
RETURN VALUE
the kopen flags on success. If type is NULL or an invalid
type, a -1 will be returned.
DESCRIPTION
The ktype_to_flags() routine is used to convert the
type field used in the kfopen() call into their corresponding
equivalent in the flags field of the kopen() call.
The "type" parameter is converted and returned in
kopen flag form. The following is an example of how
to use ktype_to_flags():
flags = ktype_to_flags("w");
the input flags are converted and result returned to
type will be KOPEN_WRONLY|KOPEN_CREAT|KOPEN_TRUNC.
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.