summaryrefslogtreecommitdiff
path: root/ws2a/bugsdata.c
blob: 4517ff65df0cac46846abb6413a714bc9b1b0782 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>

int main(){
  printf("%s%c%c\n",
  "Content-Type:text/html;charset=iso-8859-1",13,10);
  FILE* lastfilenum;
  lastfilenum = fopen("../ws2a/bugs/lastbug","r");
  if(lastfilenum == NULL){
    printf("Error reteriveing bugs, contact the admin!");
  }
  long long last = 0;
  fscanf(lastfilenum,"%u",&last);
  long long end = last-20;
  while(last > end && last > 0){
    char filestring[64];
    char filename[10];
    strcat(filestring,"../ws2a/bugs/");
    itoa(last,filename,10)
    strcat(filestring,filename);
    FILE* thisbug;
    thisbug = fopen(filestring,"r");
    if(thisbug == NULL){
      printf("Error opening bug:%d\n",last);
      continue;
    }
    while(!feof(thisbug)){
      putchar(fgetc(thisbug));
    }
    printf("<br/>");
    last--;
  }
}