#include "memo.h"


delete_memos(nmemos, memos)
int nmemos;
char *memos[];
{
	int n, i;
	FILE *nfp;
	char nmfile[128];
	long stop_t, start_t, repeat_t;
	char text[MAXLINE];
	
	clr_specs();
	while (nmemos-- > 0)
		parse_specs(*memos++);
	
	if ((fp = fopen(mfile, "r")) == NULL) {
		fprintf(stderr, "memo: can't open memo file %s\n", mfile);
		exit(1);
	}
	get_temp_file(nmfile);
	if ((nfp = fopen(nmfile, "w")) == NULL) {
		fprintf(stderr, "memo: can't open temp file %s\n", nmfile);
		exit(1);
	}
	
	for (i=1; fscanf(fp, "%ld%ld%ld", &start_t, &stop_t, &repeat_t) != EOF && fgets(text, MAXLINE, fp) != NULL; i++) {	
		if (!check_specs(i))
			fprintf(nfp, "%ld %ld %ld%s", start_t, stop_t, repeat_t, text);
	}
	fclose(nfp);
	fclose(fp);
	flip_files(mfile, nmfile);
}
