]> bicyclesonthemoon.info Git - ott/enhance/commitdiff
Interface! The results are for me only!
authorb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Mon, 30 Dec 2013 18:08:36 +0000 (18:08 +0000)
committerb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Mon, 30 Dec 2013 18:08:36 +0000 (18:08 +0000)
git-svn-id: svn://botcastle1b/npb@18 0d794883-4e4e-4f65-aa7a-0e7f5947bab5

makefile
npb
npb.cpp
npbd
npbd.cpp

index 255abbaafadf343f75ee3685bb10bfd55d7b7a2d..34ab1149fbf9a2cef62f6a4dc360d0afc9a25251 100644 (file)
--- a/makefile
+++ b/makefile
@@ -9,4 +9,4 @@ npb: npb.cpp makefile
        $(CC) $(CF) $(LF) -o npb npb.cpp
 
 npbd: npb npbd.cpp makefile
-       $(CC) $(CF) -o npbd npbd.cpp
+       $(CC) $(CF) -o npbd npbd.cpp $(LF2)
diff --git a/npb b/npb
index 8b76126f9800ada2448d80b53c697e3fe3079a96..f39f1b12192061571535fe2eca6675036e90e46a 100755 (executable)
Binary files a/npb and b/npb differ
diff --git a/npb.cpp b/npb.cpp
index 10f41f002fb94650a6c66b7498952a2d50427b46..a08e577b7ec69a5ef1e1ee96ee12551da4bd9df7 100644 (file)
--- a/npb.cpp
+++ b/npb.cpp
@@ -1,8 +1,11 @@
-    //  //  It's NewpixbOTTification Time!
-   //  //   Take a picture and add a newpixbot to it!
-  //  //    Requires Dev Image Library, on Pentium III libdevil must be recompiled with --disable-ssl2 --disable-ssl3
- //  //
-//  //      ~~bicyclesonthemoon
+    //  //It's NewpixbOTTification Time!
+   //  // Take a picture and add a newpixbot to it!
+  //  //  
+ //  //   Requires Dev Image Library,
+//  //  //on Pentium III libdevil must be
+   //  // recompiled with --disable-ssl2 --disable-ssl3
+  //  //
+ //  //   ~~bicyclesonthemoon
 
 #define INPIX_MUSTARD 1
 #define OUTPIX_MUSTARD 2
diff --git a/npbd b/npbd
index 947d9d0317cdec38f45bd258137ab10a68106dde..acaa15dc3a8ad8f720c0861090e3bbcc8e6ae730 100755 (executable)
Binary files a/npbd and b/npbd differ
index 920b15476900588415088fb67f9f2e7bbb5688a1..831d80b45a28ce7319b6d1314123f16b418433d3 100644 (file)
--- a/npbd.cpp
+++ b/npbd.cpp
@@ -1,6 +1,68 @@
+    //  //Download images and add
+   //  // Newpixbots to them!
+  //  //  
+ //  //   Requires cgilib
+//  //  //line 146 of cgi.h
+   //  // must be changed
+  //  //  from "extern }"
+ //  //   to "}"
+//  //  //
+   //  // ~~bicyclesonthemoon
+
+#include <cgi.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#define WGET_PATH "/usr/bin/wget"
+#define NPB_PATH  "./npb"
+
+int main (int argc, char *argv[]);
 int main (int argc, char *argv[])
 {
-       printf("Content-type: text/html\n\n<html><head><title>It's NewpixbOTTification time!</title></head><body><h1>It's NewpixbOTTification time!</body></html>\n");
+       FILE *pix;
+       char url[1024];
+       char path[256];
+       //char cmd[1024];
+       s_cgi *cgi;
+       int t;
+       pid_t sub;
+       
+       cgi=cgiInit();
+       sprintf(url,"%s",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","-O",path,url,(char *)0);
+               return t;
+       }
+       waitpid(sub,&t,0);
+       if(t)return t;
+       
+       sub=fork();
+       if(sub==0)
+       {
+               t=execl(NPB_PATH,NPB_PATH,path,path,"q",(char *)0);
+               return t;
+       }
+       waitpid(sub,&t,0);
+       
+       printf("Content-type: text/html\n\n");
+       printf("<html><head><title>It's NewpixbOTTification time!</title></head><body>");
+       printf("<h1>It's NewpixbOTTification time!</h1>");
+       printf("%s<br>",path);
+       printf("%s<br>",url);
+       printf("%d<br>",t);
+       printf("%lu<br>",(unsigned long)sub);
+       printf("</body></html>\n");
+       
+       
+       
+       //npbpix=fopen("/var/tmp/test","wb");
+       //fclose(npbpix);
        return 0;
 }
\ No newline at end of file