diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-09 15:09:39 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-09 15:09:39 -0400 |
| commit | d76c91bc98f2a27353f96c81fb587354f7577060 (patch) | |
| tree | c53920a462258a851aa5574b82a3a3173e560449 /ws2a/bugsdata.c | |
| parent | da20f5a85c2b03e390a231a15d30a7ed411823f4 (diff) | |
| download | webpage-d76c91bc98f2a27353f96c81fb587354f7577060.tar.gz webpage-d76c91bc98f2a27353f96c81fb587354f7577060.tar.bz2 webpage-d76c91bc98f2a27353f96c81fb587354f7577060.zip | |
corrected recent bugs reporter
Diffstat (limited to 'ws2a/bugsdata.c')
| -rw-r--r-- | ws2a/bugsdata.c | 47 |
1 files changed, 38 insertions, 9 deletions
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("<br/>"); + last--; continue; } - while(!feof(thisbug)){ - putchar(fgetc(thisbug)); - } - printf("<br/>"); + printf("<tr>"); + printbug(thisbug); + fclose(thisbug); + printf("</tr>"); last--; } + + return 0; +} +/*Prints bugs, format: + Submitter\n + Date_submitted\n + Short Description\n + Status<Unassigned, Assigned, Closed>\n +*/ +void printbug(FILE* f){ + printf("<td>"); + int part = 0; + while(!feof(f)){ + char c = fgetc(f); + if(c == '\n'){ + part++; + printf("</td>"); + if(part != 2){ + printf("<td>"); + } + } + else{ + putchar(c); + } + } } |
