|
NAMEmbkfopen - open a file with several search paths See the file man1/alc_origin.1. SYNOPSIS#include "mut.h" FILE ∗mbkfopen(name, extension, mode) char ∗name, ∗extension, ∗mode; PARAMETERSDESCRIPTIONmbkfopen opens a file, searching it through the paths given
in the environment variables MBK_CATA_LIB(1) and
MBK_WORK_LIB(1). Its main issue is to enable simple file access for
any program that works with mbk path environment variables.
The search algorithm depends on the value of mode. If mode is WRITE_TEXT, then the file is open for writing in MBK_WORK_LIB(1). If mode is READ_TEXT then the file is first searched through MBK_WORK_LIB(1), and if not found, through each directory specified in MBK_CATA_LIB(1), in the order of declaration under unix. No internal hash table is generated, in order to let the user choose its directory priority. As soon as the file is found, it is opened. There is no check for redundant files in the specified paths, since it is neither illegal nor bad to have many files with the same names. RETURN VALUEmbkfopen returns a pointer to the opened file. If the file read or write access are violated, or the file not found, a NULL pointer is returned. ERROR"∗∗∗ mbk error ∗∗∗ mbkfopen : unknown file opening mode mode" The mode parameter is not one of the two legal
values.
EXAMPLE
#include "mut.h"
#include "mph.h"
phfig_list ∗load_vti_ph(name)
char ∗name;
{
FILE ∗file;
if ((file = mbkfopen(name, "cp", READ_TEXT)) == NULL) {
(void)fprintf(stderr, "Pfhhh, can't open name.cp\n");
EXIT();
}
ph_parse(file);
}
SEE ALSOmbk(1), MBK_CATA_LIB(1), MBK_WORK_LIB(1), loadlofig(3), loadphfig(3), savelofig(3), savephfig(3), fopen(3). See the file man1/alc_bug_report.1.
|