#include "actrecs.h"
#define ACTDAT "/accting/360file"
struct ibment ibm;

main(c,v)
char **v;
{
	register char **s;
	register int i;
	int fd;

	if(c < 2){
		printf("Usage: stopsend 360name ...\n");
		exit(1);
	}

	if((fd = open(ACTDAT, 2)) == -1){
		printf("No 360file\n");
		exit(2);
	}
	v++;
	while(read(fd, &ibm, IREAD) == IREAD)
		for(s = v, i = 1; i < c; i++){
			if(eql(ibm.name, *s)){
				lseek(fd, -(long)(IREAD), 1);
				**s = 0;
				ibm.send = 'X';
				write(fd, &ibm, IREAD);
				break;
			} else s++;
		}
	for(i = 1, s = v; i < c; i++, s++)
		if(**s)printf("%s not found in 360file\n", *s);
	close(fd);
	exit(0);
}

eql(s,t)
register char *s, *t;
{

	while(*s){
		if((*s == ':' || *s == ' ') && *t == 0)return(1);
		if(*t >= 'a' && *t <= 'z')*t =& ~040;
		if((*t++) != (*s++))return(0);
	}
	printf("stopsend: 360file no colon after name, bad format\n");
	exit(3);
}

