From df6924f032a383172e1d024560e28cfc3b22d563 Mon Sep 17 00:00:00 2001 From: jihoonl Date: Sat, 31 Oct 2009 01:14:22 +0000 Subject: [PATCH] email generator --- .../Distributed/SpamFilter/emails/gen.c | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/Robust/src/Benchmarks/Distributed/SpamFilter/emails/gen.c b/Robust/src/Benchmarks/Distributed/SpamFilter/emails/gen.c index 55a09789..396feeb8 100644 --- a/Robust/src/Benchmarks/Distributed/SpamFilter/emails/gen.c +++ b/Robust/src/Benchmarks/Distributed/SpamFilter/emails/gen.c @@ -11,6 +11,7 @@ char** readList(char* fileName,int* num); void generateEmails(int,char**,int,char**,int,char**,int,char*); void freeList(char**,int); +void writeString(FILE* newFile,char* prefix,char** list,int size_list); int main() { @@ -91,36 +92,45 @@ void generateEmails(int num_email,char** wl,int word_num,char** ul,int url_num,c for(i=0; i < num_email;i++) { - sprintf(fileNameBuffer,"%s%d",fileName,i+1); newFile = fopen(fileNameBuffer,"w"); - // write account name - rand_index = rand() % ac_num; - ptr = al[rand_index]; // get random account name - fprintf(newFile,"%s\n",ptr); - // write header - fprintf(newFile,"Title%d\n",i+1); + fprintf(newFile,"MessageID: %d\n",i+1); + + + // write to account name + writeString(newFile,"To: ",al,ac_num); + fprintf(newFile,"\n"); + + // write from account name + writeString(newFile,"From: ",al,ac_num); + fprintf(newFile,"\n"); + + // write cc + writeString(newFile,"Cc: ",al,ac_num); + fprintf(newFile,"\n"); + + // write title + writeString(newFile,"Title: ",wl,word_num); + fprintf(newFile,"\n"); // write Body bodyLength = rand() % 500 + 300; - for(j=0;j