Table of Contents

Name

mbkfopen - open a file with several search pathes

Origin

This software belongs to the ALLIANCE CAD system from the CAO-VLSI team at ASIM/LIP6/UPMC laboratory.
LIP6/ASIM
University P. et M. Curie 4, place Jussieu 75252 PARIS Cedex 05 FRANCE
Fax : {33/0} 1.44.27.62.86
E-mail support : alliance-support@asim.lip6.fr

Synopsys

#include mut315.h"
FILE *mbkfopen(name, extension, mode)
char *name, *extension, *mode;

Parameters

name
Name of the file to be opened
extension
Extension to the file name
model
File opening mode

Description

mbkfopen opens a file, searching it through the pathes 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 file to be opened is called name.extension, if extension is not NULL, else it is name. If extension is the empty string, ", then the file name will be name. .
The legal values for mode are

READ_TEXT
opens for reading
WRITE_TEXT
discards and opens for writting since disk access should be a straight forward operation knowing mbk's needs.

The search algorithm depends on the value of mode. If mode is WRITE_TEXT, then the file is open for writting 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 pathes, since it is neither illegal nor bad to have many files with the same names.

Return Value

mbkfopen 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 mut315.h"
#include mph315.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 Also

mbk(1) , MBK_CATA_LIB(1) , MBK_WORK_LIB(1) , loadlofig(3) , loadphfig(3) , savelofig(3) , savephfig(3) , fopen(3) .

Bug Report

This tool is under development at the ASIM/LIP6/UPMC laboratory, cao-vlsi research team.
We need your feedbak to improve documentation and tools. If you find bugs, please fill-in the form at http://asim.lip6.fr/alliance/support/bug-report/ Thanks for doing this.


Table of Contents

 



Alliance Web Site © 1997, 2002 ASIM/LIP6/UPMC, page maintained by Czo [Olivier Sirol] , last updated on 26 May 2000.