src/gedlib/charmaps.c
/*====================================================
 * init_map_from_file -- Init single translation table
 *  file: [IN]  file from which to read translation table
 *  indx: [IN]  which translation table (see defn of map_keys)
 *  ptt:  [OUT] new translation table if created
 * Returns FALSE if error.
 * But if file is empty, *ptt=0 and returns TRUE.
 *==================================================*/
- Init single translation table
file: [IN]  file from which to read translation table
indx: [IN]  which translation table
ptt:  [OUT] new translation table if created
Returns FALSE if error.
But if file is empty, *ptt=0 and returns TRUE.
- Init single translation table file : [ IN ] file from which to read translation table indx : [ IN ] which translation table ptt : [ OUT ] new translation table if created Returns FALSE if error . But if file is empty * ptt = 0 and returns TRUE .
BOOLEAN
init_map_from_file (CNSTRING file, CNSTRING mapname, TRANTABLE * ptt, ZSTR zerr)
{
	FILE *fp;
	struct stat buf;
	STRING mem;
	INT siz;
	BOOLEAN ok;
	*ptt = 0;
	if ((fp = fopen(file, LLREADTEXT)) == NULL) return TRUE;
	ASSERT(fstat(fileno(fp), &buf) == 0);
	if (buf.st_size == 0) {
		fclose(fp);
		return TRUE;
	}
	mem = (STRING) stdalloc(buf.st_size+1);
	mem[buf.st_size] = 0;
	siz = fread(mem, 1, buf.st_size, fp);
	ASSERT(siz == buf.st_size || feof(fp));
	fclose(fp);
	ok = init_map_from_str(mem, mapname, ptt, zerr);
	stdfree(mem);
	return ok;
}
BOOLEAN init_map_from_file ( CNSTRING file , CNSTRING mapname , TRANTABLE * ptt , ZSTR zerr ) { FILE * fp ; struct stat buf ; STRING mem ; INT siz ; BOOLEAN ok ; * ptt = 0 ; if ( ( fp = fopen ( file , LLREADTEXT ) ) == NULL ) return TRUE ; ASSERT ( fstat ( fileno ( fp ) , & buf ) == 0 ) ; if ( buf . st_size == 0 ) { fclose ( fp ) ; return TRUE ; } mem = ( STRING ) stdalloc ( buf . st_size + 1 ) ; mem [ buf . st_size ] = 0 ; siz = fread ( mem , 1 , buf . st_size , fp ) ; ASSERT ( siz == buf . st_size || feof ( fp ) ) ; fclose ( fp ) ; ok = init_map_from_str ( mem , mapname , ptt , zerr ) ; stdfree ( mem ) ; return ok ; }
init_map_from_file -- Init single translation table
  file: [IN]  file from which to read translation table
  indx: [IN]  which translation table (see defn of map_keys)
  ptt:  [OUT] new translation table if created
 Returns FALSE if error.
init_map_from_file -- Init single translation table file : [ IN ] file from which to read translation table indx : [ IN ] which translation table ( see defn of map_keys ) ptt : [ OUT ] new translation table if created Returns FALSE if error .
/* may not read full buffer on Windows due to CR/LF translation */