From 14085e0d6c1baf9ba478cd5d436a59b2f1f261c4 Mon Sep 17 00:00:00 2001 From: pk910 Date: Sat, 5 Nov 2011 07:01:15 +0100 Subject: [PATCH] made cmd_extscript WIN32 compatible --- src/cmd_neonserv_extscript.c | 4 ++++ src/main.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cmd_neonserv_extscript.c b/src/cmd_neonserv_extscript.c index 21aad8b..1d97ac0 100644 --- a/src/cmd_neonserv_extscript.c +++ b/src/cmd_neonserv_extscript.c @@ -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 } diff --git a/src/main.h b/src/main.h index 2b31e62..a2e9af1 100644 --- a/src/main.h +++ b/src/main.h @@ -37,11 +37,11 @@ #include #include #include +#include #endif #include #include #include -#include #include #if __GNUC__ -- 2.20.1