]> git.stg.codes - stg.git/blobdiff - projects/stargazer/main.cpp
Move variables declaration to the beginning of the function (old C)
[stg.git] / projects / stargazer / main.cpp
index 3839ae8edb9495da7808fef22227a54744d7fdfc..375823481175b522bdd22a5e06677b3fd6e5f854 100644 (file)
@@ -46,9 +46,7 @@
 #include "stg/plugin.h"
 #include "stg/logger.h"
 #include "stg/scriptexecuter.h"
 #include "stg/plugin.h"
 #include "stg/logger.h"
 #include "stg/scriptexecuter.h"
-#include "stg/conffiles.h"
 #include "stg/version.h"
 #include "stg/version.h"
-#include "stg/pinger.h"
 #include "stg_timer.h"
 #include "settings_impl.h"
 #include "users_impl.h"
 #include "stg_timer.h"
 #include "settings_impl.h"
 #include "users_impl.h"
@@ -101,7 +99,11 @@ else
     }
 }
 //-----------------------------------------------------------------------------
     }
 }
 //-----------------------------------------------------------------------------
+#ifdef LINUX
 int StartScriptExecuter(char * procName, int msgKey, int * msgID, SETTINGS_IMPL * settings)
 int StartScriptExecuter(char * procName, int msgKey, int * msgID, SETTINGS_IMPL * settings)
+#else
+int StartScriptExecuter(char *, int msgKey, int * msgID, SETTINGS_IMPL * settings)
+#endif
 {
 STG_LOGGER & WriteServLog = GetStgLogger();
 
 {
 STG_LOGGER & WriteServLog = GetStgLogger();
 
@@ -142,12 +144,20 @@ switch (executerPid)
 
     case 0:
         delete settings;
 
     case 0:
         delete settings;
+#ifdef LINUX
         Executer(*msgID, executerPid, procName);
         Executer(*msgID, executerPid, procName);
+#else
+        Executer(*msgID, executerPid);
+#endif
         return 1;
 
     default:
         if (executersPid.empty()) {
         return 1;
 
     default:
         if (executersPid.empty()) {
+#ifdef LINUX
             Executer(*msgID, executerPid, NULL);
             Executer(*msgID, executerPid, NULL);
+#else
+            Executer(*msgID, executerPid);
+#endif
         }
         executersPid.insert(executerPid);
     }
         }
         executersPid.insert(executerPid);
     }
@@ -161,11 +171,11 @@ int ForkAndWait(const string &)
 #endif
 {
 #ifndef NO_DAEMON
 #endif
 {
 #ifndef NO_DAEMON
-stgChildPid = fork();
+pid_t childPid = fork();
 string startFile = confDir + START_FILE;
 unlink(startFile.c_str());
 
 string startFile = confDir + START_FILE;
 unlink(startFile.c_str());
 
-switch (stgChildPid)
+switch (childPid)
     {
     case -1:
         return -1;
     {
     case -1:
         return -1;