|
samba unix风格的配置文件配置信息读取C代码.(21) */ { char *func = "params.c:OpenConfFile() -"; //extern BOOL in_client; //int lvl = in_client?1:0; myFILE *ret; ret = (myFILE *)malloc(sizeof(*ret)); if (!ret) return NULL; ret->buf = file_load(FileName, &ret->size); if( NULL == ret->buf ) { //DEBUG( lvl, // ("%s Unable to open configuration file \"%s\":\n\t%s\n", // func, FileName, strerror(errno)) ); SAFE_FREE(ret); return NULL; } ret->p = ret->buf; return( ret ); } /* OpenConfFile */ BOOL pm_process( char *FileName, BOOL (*sfunc)(char *), BOOL (*pfunc)(char *, char *) ) /* ------------------------------------------------------------------------ ** * Process the named parameter file. * * Input: FileName - The pathname of the parameter file to be opened. * sfunc - A pointer to a function that will be called when * a section name is discovered. * pfunc - A pointer to a function that will be called when * a parameter name and value are discovered. *
|