From c2a74cc20ebaa9898052ab758821ccfc7c3ee1f4 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Thu, 2 Jun 2016 16:54:20 -0400 Subject: Initial commit --- src/bugsdata.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/bugsdata.c (limited to 'src/bugsdata.c') diff --git a/src/bugsdata.c b/src/bugsdata.c new file mode 100644 index 0000000..a7b5b8e --- /dev/null +++ b/src/bugsdata.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include "config.h" + +void printbug(FILE* f); + +int main(){ + printf("%s%c%c\n", + "Content-Type:text/html;charset=iso-8859-1",13,10); + FILE* lastfilenum; + char lastfilenumpath[100]; + sprintf(lastfilenumpath,"%s/bugs/lastbug",REL_BINPATH); + lastfilenum = fopen(lastfilenumpath,"r"); + if(lastfilenum == NULL){ + printf("Error reteriveing bugs, contact the admin!"); + return 1; + } + long long last = 0; + fscanf(lastfilenum,"%lld",&last); + fclose(lastfilenum); + long long end = last-20; + + while(last > end && last > 0){ + char filestring[64]; + sprintf(filestring,"%s/bugs/",REL_BINPATH); + char filename[10]; + sprintf(filename,"%lld",last); + strcat(filestring,filename); + FILE* thisbug; + thisbug = fopen(filestring,"r"); + if(thisbug == NULL){ + printf("Error opening bug:%s\n",filestring); + printf("
"); + last--; + continue; + } + printbug(thisbug); + printf("%lld\n",last); + fclose(thisbug); + last--; + } + + return 0; +} -- cgit v1.2.3-70-g09d2