summaryrefslogtreecommitdiff
path: root/ws2a/showbug.c
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-09 16:39:50 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-09 16:39:50 -0400
commit3971d9d97cb9e24af383f619d94c702b3dbab15b (patch)
tree8539a4f4b5f4b1e3284ca2331e3f42a754347388 /ws2a/showbug.c
parentbfb4f9159a849accfbe402aa971cdd0f0be76c10 (diff)
downloadwebpage-3971d9d97cb9e24af383f619d94c702b3dbab15b.tar.gz
webpage-3971d9d97cb9e24af383f619d94c702b3dbab15b.tar.bz2
webpage-3971d9d97cb9e24af383f619d94c702b3dbab15b.zip
Work on showing a bug
Diffstat (limited to 'ws2a/showbug.c')
-rw-r--r--ws2a/showbug.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/ws2a/showbug.c b/ws2a/showbug.c
index b8c46e2..aa5cf7d 100644
--- a/ws2a/showbug.c
+++ b/ws2a/showbug.c
@@ -10,4 +10,36 @@ int main(){
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
printf("Data:%s",data);
+ FILE* lastfilenum;
+ lastfilenum = fopen("../ws2a/bugs/lastbug","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 thisid = 0;
+ sscanf(data,"id=%lld",&thisid);
+ printf("Looking for bugid:%lld",thisid);
+ if(thisid > last){
+ printf("Invalid!");
+ return 1;
+ }
+
+ char filestring[64] = "../ws2a/bugs/";
+ char filename[10];
+ sprintf(filename,"%lld",thisid);
+ strcat(filestring,filename);
+ FILE* bugfile;
+ bugfile = fopen(filestring,"r");
+ if(bugfile == NULL){
+ printf("Unable to open bug file!");
+ return 1;
+ }
+ while(!feof(bugfile)){
+ printf("File:");
+ putchar(fgetc(bugfile));
+ }
+ fclose(bugfile);
}