made cmd_extscript WIN32 compatible
authorpk910 <philipp@zoelle1.de>
Sat, 5 Nov 2011 06:01:15 +0000 (07:01 +0100)
committerpk910 <philipp@zoelle1.de>
Sat, 5 Nov 2011 06:03:12 +0000 (07:03 +0100)
src/cmd_neonserv_extscript.c
src/main.h

index 21aad8b9f0abb844d2fb26c9e50126906eb3f2bb..1d97ac0fc576bb5bafa1adbfdd62c8802565713e 100644 (file)
@@ -112,11 +112,13 @@ CMD_BIND(neonserv_cmd_extscript) {
     command[commandpos] = '\0';
     //we should now have a valid command
     struct ClientSocket *textbot = getTextBot();
+       #ifndef WIN32
     pid_t pID = fork();
     if (pID == 0) { //We're the child process :D
         pID = fork();
         if(pID < 0) exit(EXIT_FAILURE);
         if(pID != 0) exit(EXIT_SUCCESS);
+       #endif
         FILE *fp;
         fp = popen(command, "r");
         if (fp) {
@@ -133,6 +135,7 @@ CMD_BIND(neonserv_cmd_extscript) {
         } else {
             reply(getTextBot(), user, "internal bot error - please contact an administrator!");
         }
+       #ifndef WIN32
         exit(EXIT_FAILURE);
     } else if (pID < 0) {
         reply(getTextBot(), user, "internal bot error - please contact an administrator!");
@@ -140,5 +143,6 @@ CMD_BIND(neonserv_cmd_extscript) {
         //parent bot - continue program
         wait(NULL);
     }
+       #endif
 }
 
index 2b31e62edefaa2cacd26a89f57441337c6461736..a2e9af1352a535e547778cbe3dfae90ce14dbaa0 100644 (file)
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#include <sys/wait.h>
 #endif
 #include <unistd.h>
 #include <stdarg.h>
 #include <sys/time.h>
-#include <sys/wait.h>
 #include <time.h>
 
 #if __GNUC__