From f2927f74d768b3e732a6074d2faa28a6a14d04a8 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 11 May 2016 17:38:10 -0400 Subject: Fixed bugs display to not need to keep track of comments --- cgi-bin/a.exe | Bin 0 -> 70440 bytes ws2a/bugs/1 | 3 +-- ws2a/bugs/2 | 1 - ws2a/bugs/3 | 1 - ws2a/bugs/4 | 1 - ws2a/bugs/5 | 1 - ws2a/bugs/6 | 1 - ws2a/bugs/7 | 1 - ws2a/bugs/8 | 1 - ws2a/bugsdata.c | 33 +++++++++++++++++---------------- 10 files changed, 18 insertions(+), 25 deletions(-) create mode 100644 cgi-bin/a.exe diff --git a/cgi-bin/a.exe b/cgi-bin/a.exe new file mode 100644 index 0000000..ce182f6 Binary files /dev/null and b/cgi-bin/a.exe differ diff --git a/ws2a/bugs/1 b/ws2a/bugs/1 index 932a7ab..f2d27fe 100644 --- a/ws2a/bugs/1 +++ b/ws2a/bugs/1 @@ -4,7 +4,6 @@ Date_submitted Short Description 0: Long description -2 User person sdlfkj13221lkjl @@ -15,5 +14,5 @@ Another User Their comment Apickx -eD=$U&C]s&Ofyr6y^"{*cmd.Zò̺ +eD=$U&C]s&Ofyr6y^"{*cmd.Z�̺ This Is My Comment diff --git a/ws2a/bugs/2 b/ws2a/bugs/2 index 1a3b1db..79813e9 100644 --- a/ws2a/bugs/2 +++ b/ws2a/bugs/2 @@ -4,4 +4,3 @@ Date_submitted Short Description 0: Long description -0 diff --git a/ws2a/bugs/3 b/ws2a/bugs/3 index d4f6325..a098504 100644 --- a/ws2a/bugs/3 +++ b/ws2a/bugs/3 @@ -4,4 +4,3 @@ Date_submitted Short Description 1:Test User Long description -0 diff --git a/ws2a/bugs/4 b/ws2a/bugs/4 index f4b517a..6fb6752 100644 --- a/ws2a/bugs/4 +++ b/ws2a/bugs/4 @@ -4,4 +4,3 @@ Date_submitted Short Description 2: Long description -0 diff --git a/ws2a/bugs/5 b/ws2a/bugs/5 index 2eabc1e..92d3f6f 100644 --- a/ws2a/bugs/5 +++ b/ws2a/bugs/5 @@ -4,4 +4,3 @@ Date_submitted Short Description 0: Long description -0 diff --git a/ws2a/bugs/6 b/ws2a/bugs/6 index a424908..36dc7fb 100644 --- a/ws2a/bugs/6 +++ b/ws2a/bugs/6 @@ -4,4 +4,3 @@ Date_submitted Short Description 1:Another test user Long description -0 diff --git a/ws2a/bugs/7 b/ws2a/bugs/7 index 8a7e203..3df129f 100644 --- a/ws2a/bugs/7 +++ b/ws2a/bugs/7 @@ -4,4 +4,3 @@ Date_submitted Short Description 2: Long description -0 diff --git a/ws2a/bugs/8 b/ws2a/bugs/8 index 4c55c82..cb01572 100644 --- a/ws2a/bugs/8 +++ b/ws2a/bugs/8 @@ -4,4 +4,3 @@ Date_submitted Short Description 2: Long description -0 diff --git a/ws2a/bugsdata.c b/ws2a/bugsdata.c index 5deecaf..0370147 100644 --- a/ws2a/bugsdata.c +++ b/ws2a/bugsdata.c @@ -40,28 +40,29 @@ int main(){ } /*Prints bugs, format: Submitter\n + SubmitterID Date_submitted\n Short Description\n Status\n - long description + numcomments\n + bugid */ void printbug(FILE* f){ - int part = 0; - while(!feof(f) && part < 7){ - char c = fgetc(f); - if(feof(f)){ - return; - } - if(c == '\n'){ - part++; - if(part != 5){ - putchar(c); - } - } - else if(part != 5){ - putchar(c); - } + + int line = 0; + char tchar = ' '; + while((tchar = fgetc(f)) && tchar != EOF){ + if(tchar == '\n') + line++; + if(line > 4) + break; + putchar(tchar); } + + unsigned int comments = 0; + while (EOF != (fscanf(f,"%*[^\n]"), fscanf(f,"%*c"))) + ++comments; + printf("\n%u\n",(comments-1)/4); } /* -- cgit v1.2.3-70-g09d2