From d76c91bc98f2a27353f96c81fb587354f7577060 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 9 May 2016 15:09:39 -0400 Subject: corrected recent bugs reporter --- ws2a/bugsdata.c | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'ws2a/bugsdata.c') diff --git a/ws2a/bugsdata.c b/ws2a/bugsdata.c index e0f9042..e587e4c 100644 --- a/ws2a/bugsdata.c +++ b/ws2a/bugsdata.c @@ -10,26 +10,55 @@ int main(){ lastfilenum = fopen("../ws2a/bugs/lastbug","r"); if(lastfilenum == NULL){ printf("Error reteriveing bugs, contact the admin!"); + return 1; } long long last = 0; - fscanf(lastfilenum,"%u",&last); + fscanf(lastfilenum,"%lld",&last); + fclose(lastfilenum); long long end = last-20; + while(last > end && last > 0){ - char filestring[64]; + char filestring[64] = "../ws2a/bugs/"; char filename[10]; - strcat(filestring,"../ws2a/bugs/"); - sprintf(filename,"%d",last); + sprintf(filename,"%lld",last); strcat(filestring,filename); FILE* thisbug; thisbug = fopen(filestring,"r"); if(thisbug == NULL){ - printf("Error opening bug:%d\n",last); + printf("Error opening bug:%s\n",filestring); + printf("
"); + last--; continue; } - while(!feof(thisbug)){ - putchar(fgetc(thisbug)); - } - printf("
"); + printf(""); + printbug(thisbug); + fclose(thisbug); + printf(""); last--; } + + return 0; +} +/*Prints bugs, format: + Submitter\n + Date_submitted\n + Short Description\n + Status\n +*/ +void printbug(FILE* f){ + printf(""); + int part = 0; + while(!feof(f)){ + char c = fgetc(f); + if(c == '\n'){ + part++; + printf(""); + if(part != 2){ + printf(""); + } + } + else{ + putchar(c); + } + } } -- cgit v1.2.3-70-g09d2