예제 #1
0
str_list_t DLLCALL trashcan_list(scfg_t* cfg, const char* name)
{
	char	fname[MAX_PATH+1];
	FILE*	fp;
	str_list_t	list;

	if((fp=fopen(trashcan_fname(cfg, name, fname, sizeof(fname)),"r"))==NULL)
		return NULL;

	list=strListReadFile(fp,NULL,255);

	fclose(fp);

	return list;
}
예제 #2
0
str_list_t*	dataReadFile(FILE* fp, str_list_t* columns, dataLineParser_t lineParser)
{
	str_list_t*	records;
	str_list_t	lines;
	size_t		i;

	rewind(fp);

	if((lines=strListReadFile(fp, NULL, 0))==NULL)
		return(NULL);

	/* truncate line-feed chars off end of strings */
	for(i=0; lines[i]!=NULL; i++)
		truncnl(lines[i]);

	records=dataParseList(lines,columns,lineParser);

	strListFree(&lines);

	return(records);
}