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/popups.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/popups.c (limited to 'src/popups.c') diff --git a/src/popups.c b/src/popups.c new file mode 100644 index 0000000..9ebe090 --- /dev/null +++ b/src/popups.c @@ -0,0 +1,53 @@ +#include +#include +#include "shared.h" +#include "config.h" + +int main(){ + //char* data = getenv("QUERY_STRING"); + char data[] = "user=Apickx"; + char user[30]; + sscanf(data,"user=%29s",user); + char recentbugspath[100]; + sprintf(recentbugspath,"%s/bugs/recent",REL_BINPATH); + FILE* recentfile; + recentfile = fopen(recentbugspath,"r"); + if(recentfile == NULL){ + printf("Unable to open recent file"); + } + int recentline = 0; + while(recentline < 20){ + char bugnumstring[10]; + int bnsp = 0; + char c; + while(!feof(recentfile) && (c = fgetc(recentfile)) && c!=EOF && c!='\n'){ + bugnumstring[bnsp] = c; + bnsp++; + } + bugnumstring[bnsp] = '\0'; + unsigned long long bugnum; + sscanf(bugnumstring,"%llu",&bugnum); + char thisbugfilepath[100]; + sprintf(thisbugfilepath,"%s/bugs/%llu",REL_BINPATH,bugnum); + FILE* thisbugfile; + thisbugfile = fopen(thisbugfilepath,"r"); + int bugfileline = 1; + while(bugfileline != 5){ + char c = fgetc(thisbugfile); + if(c == '\n'){ + bugfileline++; + } + } + char assignee[64]; + int type; + fscanf(thisbugfile,"%d:%s\n",&type,assignee); + if(type == 1){ + if(strcmp(assignee,user) == 0){ + printf("I found a bug for me! Num:%d\n",bugnum); + } + } + + + recentline++; + } +} -- cgit v1.2.3-70-g09d2