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

int main (int argc, char *argv[])

{
int	i;
char	text[320],filename[320];
FILE	*fpt;

if (argc != 2)
  {
  printf("Usage:  make-events [subject-folder]\n");
  exit(0);
  }

sprintf(text,"dos2unix %s/*/*-events.txt",argv[1]);
system(text);

sprintf(text,"ls %s/*/*.act > files.txt",argv[1]);
system(text);

fpt=fopen("files.txt","r");
while (1)
  {
  i=fscanf(fpt,"%s",filename);
  if (i != 1)
    break;
  sprintf(text,"ema-to-events EMA3.csv %s",filename);
  system(text);
  }
fclose(fpt);

sprintf(text,"/bin/rm files.txt");
system(text);

}

