/*
 * This file is part of the program "zping" and contains the
 * code to read in files and run them through again...
 *
 *      Created by: Derek Atkins
 */

#include <stdio.h>
#include <string.h>

extern char *whoami;
extern int onesent, nrecips;

readfile(filename)
char *filename;

{
    FILE *fp;
    char *buf[2];
    char name[BUFSIZ];

    if ((fp = fopen(filename, "r")) == NULL) {
	printf("Cannot open file %s\n",filename);
	return(1);
    }
    
    while (fscanf(fp, "%s\n", name) != EOF) {
	if (strcmp(name,"\n")) {
	    onesent = 1;
	    buf[0] = whoami;
	    buf[1] = name;
	    main(2, buf);
	    nrecips = 0;
	}
    }
    fclose(fp);
    return(1);
} 
 
