#include	<stdio.h>
#include	"fl.h"
#include	"ws13.h"

void fatal(char *s1, char *s2);

//
//	process(fmt, data)
//
//	Purpose: read from datafile, format and output selected records
//	Input:   fmt 		- input stream from format file
//		     data		- stream from datafile
//	Output:  copied fmt to stdout with insertions
//	Errors:  not reported, functions call fatal() and die
//


void process(FILE *fmt, FILE *data)
{
	symtab_t wordlist;

	if ((wordlist = new_table()) == NULL )
		fatal("Cannot create storage object","");

	while (get_record(wordlist, data) != NO )	// while more data
	{
		mailmerge(wordlist, fmt);				// merge with format
		clear_table(wordlist);			    	// discard data
	}
}

