]> bicyclesonthemoon.info Git - ott/enhance/blobdiff - nofading-cgi.c
reveal online
[ott/enhance] / nofading-cgi.c
index 5b4f065562aa98b2bb895db2527fa040e92d6305..1c3c410452bc4923ad690d8c6f1278768ca0ec9f 100644 (file)
@@ -134,121 +134,3 @@ int nofading (
        waitpid(sub, &r, 0);
        return r;
 }
-
-/*
-
-
-#include <cgi.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-
-#define WGET_PATH  "/usr/bin/wget"
-#define ENH_PATH   "./nofading"
-#define RM_PATH    "/bin/rm"
-#define LOG_PATH   "/eizm/log/nofading/nofading.log"
-#define USERAGENT  "No fading (1190.bicyclesonthemoon.dnsd.info/nofading/nofading.htm)"
-#define MSTD_PATH  "/pro/nofading/nf.png"
-
-int main (int argc, char *argv[]);
-void mustard(int mustard);
-
-FILE *pix;
-
-char url[1024];
-char path[256];
-s_cgi *cgi;
-int t;
-pid_t sub;
-
-int main (int argc, char *argv[])
-{
-       unsigned char buf[1024];
-       struct stat st;
-       unsigned long p;
-       unsigned short q;
-       char **up;
-
-       cgi=cgiInit();
-       
-       up=cgiGetFiles(cgi);
-       if (up)
-       {
-               sprintf(path,"%s",cgiGetFile(cgi,up[0])->tmpfile);
-               sprintf(url,"%s",cgiGetFile(cgi,up[0])->filename);
-       }
-       else
-       {
-               sprintf(url,"%s",(cgiGetValue(cgi,"inpix")!=NULL)?(cgiGetValue(cgi,"inpix")):"");
-               sprintf(path,"/var/tmp/%lu",(unsigned long)getpid());
-               
-               //Why is  there no spawnl() in linux?
-               sub=fork();
-               if(sub==0)
-               {
-                       t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",USERAGENT,"-O",path,url,(char *)0);
-                       exit(t);
-               }
-               waitpid(sub,&t,0);
-               if(t)mustard(t);
-       }
-       
-       sub=fork();
-       if(sub==0)
-       {
-               t=execl(ENH_PATH,ENH_PATH,path,path,(cgiGetValue(cgi,"f")!=NULL)?(cgiGetValue(cgi,"f")):"0","q",cgiGetValue(cgi,"a")!=NULL?"0":"a",(char *)0);
-               exit(t);
-       }
-       waitpid(sub,&t,0);
-       if(t)mustard(t);
-       
-       pix=fopen(path,"rb");
-       if(pix==NULL)
-               mustard(123);
-       fstat(fileno(pix),&st);
-       p=st.st_size/1024;
-       q=st.st_size%1024;
-       
-       printf("Content-Length: %lu\n",(unsigned long)(st.st_size));
-       printf("Content-type: image/png\n\n");
-       for(unsigned long i=0;i<p;++i)
-       {
-               fread(buf,1,1024,pix);
-               fwrite(buf,1,1024,stdout);
-       }
-       if(q!=0)
-       {
-               fread(buf,1,q,pix);
-               fwrite(buf,1,q,stdout);
-       }
-       fclose(pix);
-       fflush(stdout);
-       mustard(0);//no mustard
-}
-
-void mustard(int mustard)
-{
-       if(mustard)
-       {
-               cgiRedirect(MSTD_PATH);
-       }
-       sub=fork();
-       if(sub==0)
-       {
-               t=execl(RM_PATH,RM_PATH,"-f",path,(char *)0);
-               exit(t);
-       }
-       waitpid(sub,&t,0);
-       pix=fopen(LOG_PATH,"at");
-       if(pix!=NULL)
-       {
-               fprintf(pix,"%x %s\n",mustard,url);
-               fclose(pix);
-       }
-       exit(mustard);
-}
-
-*/
\ No newline at end of file