1 // // //Download images and
5 // // //line 146 of cgi.h
10 // // ~~bicyclesonthemoon
20 #define WGET_PATH "/usr/bin/wget"
21 #define ENH_PATH "./bluenh"
22 #define ENH_PATH2 "./bluenh2"
23 #define RM_PATH "/bin/rm"
24 #define LOG_PATH "/eizm/log/bluenh/bluenh.log"
25 #define USERAGENT "Bluenhancement\x20(1190.bicyclesonthemoon.dnsd.info/bluenh/bluenh.htm)"
26 #define MSTD_PATH "/pro/bluenh/nh.png"
28 int main (int argc, char *argv[]);
29 void mustard(int mustard);
39 int main (int argc, char *argv[])
41 unsigned char buf[1024];
53 sprintf(path,"%s",cgiGetFile(cgi,up[0])->tmpfile);
54 sprintf(url,"%s",cgiGetFile(cgi,up[0])->filename);
58 sprintf(url,"%s",(cgiGetValue(cgi,"inpix")!=NULL)?(cgiGetValue(cgi,"inpix")):"");
59 sprintf(path,"/var/tmp/%lu",(unsigned long)getpid());
61 //Why is there no spawnl() in linux?
65 t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",USERAGENT,"-O",path,url,(char *)0);
72 enh2=(cgiGetValue(cgi,"bluenh2")!=NULL);
76 t=execl(enh2?ENH_PATH2:ENH_PATH,enh2?ENH_PATH2:ENH_PATH,path,path,cgiGetValue(cgi,"a")!=NULL?cgiGetValue(cgi,"a"):"0",cgiGetValue(cgi,"b")!=NULL?cgiGetValue(cgi,"b"):"127",cgiGetValue(cgi,"c")!=NULL?cgiGetValue(cgi,"c"):"255",cgiGetValue(cgi,"d")!=NULL?cgiGetValue(cgi,"d"):"0",cgiGetValue(cgi,"e")!=NULL?cgiGetValue(cgi,"e"):"127",cgiGetValue(cgi,"f")!=NULL?cgiGetValue(cgi,"f"):"255","q",(char *)0);
85 fstat(fileno(pix),&st);
89 printf("Content-Length: %lu\n",(unsigned long)(st.st_size));
90 printf("Content-type: image/png\n\n");
91 for(unsigned long i=0;i<p;++i)
93 fread(buf,1,1024,pix);
94 fwrite(buf,1,1024,stdout);
99 fwrite(buf,1,q,stdout);
103 mustard(0);//no mustard
106 void mustard(int mustard)
110 cgiRedirect(MSTD_PATH);
115 t=execl(RM_PATH,RM_PATH,"-f",path,(char *)0);
119 pix=fopen(LOG_PATH,"at");
122 fprintf(pix,"%x %s\n",mustard,url);