Index: /branches/PublicaMundi_David-devel/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- /branches/PublicaMundi_David-devel/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 512)
+++ /branches/PublicaMundi_David-devel/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 513)
@@ -39,40 +39,28 @@
 #include "service_zcfg.h"
 }
-
 #include "ulinet.h"
-
 #include <libintl.h>
 #include <locale.h>
 #include <string.h>
-
 #include "service.h"
-
-
 #include "service_internal.h"
-
 #ifdef USE_PYTHON
 #include "service_internal_python.h"
 #endif
-
 #ifdef USE_JAVA
 #include "service_internal_java.h"
 #endif
-
 #ifdef USE_PHP
 #include "service_internal_php.h"
 #endif
-
 #ifdef USE_JS
 #include "service_internal_js.h"
 #endif
-
 #ifdef USE_RUBY
 #include "service_internal_ruby.h"
 #endif
-
 #ifdef USE_PERL
 #include "service_internal_perl.h"
 #endif
-
 #include <dirent.h>
 #include <signal.h>
@@ -92,5 +80,4 @@
 #include <time.h>
 #include <stdarg.h>
-
 #ifdef WIN32
 extern "C"
@@ -115,8 +102,6 @@
 }
 #endif
-
 #define _(String) dgettext ("zoo-kernel",String)
 #define __(String) dgettext ("zoo-service",String)
-
 extern int getServiceFromFile (maps *, const char *, service **);
 
@@ -228,5 +213,6 @@
 int
 recursReaddirF (maps * m, xmlNodePtr n, char *conf_dir, char *prefix,
-                int saved_stdout, int level, void (func) (maps *, xmlNodePtr,
+                int saved_stdout, int level, void (func) (maps *,
+                                                          xmlNodePtr,
                                                           service *))
 {
@@ -250,11 +236,12 @@
   setMapInMaps (m, "lenv", "level", levels);
   while ((dp = readdir (dirp)) != NULL)
-    if ((dp->d_type == DT_DIR || dp->d_type == DT_LNK) && dp->d_name[0] != '.'
-        && strstr (dp->d_name, ".") == NULL)
+    if ((dp->d_type == DT_DIR || dp->d_type == DT_LNK)
+        && dp->d_name[0] != '.' && strstr (dp->d_name, ".") == NULL)
       {
 
         char *tmp =
-          (char *) malloc ((strlen (conf_dir) + strlen (dp->d_name) + 2) *
-                           sizeof (char));
+          (char *)
+          malloc ((strlen (conf_dir) + strlen (dp->d_name) +
+                   2) * sizeof (char));
         sprintf (tmp, "%s/%s", conf_dir, dp->d_name);
 
@@ -266,5 +253,5 @@
         sprintf (prefix, "%s.", dp->d_name);
 
-        //map* tmpMap=getMapFromMaps(m,"lenv",tmp1);
+        // map* tmpMap=getMapFromMaps(m,"lenv",tmp1);
 
         int res;
@@ -276,6 +263,6 @@
             setMapInMaps (m, "lenv", "level", levels1);
             res =
-              recursReaddirF (m, n, tmp, prefix, saved_stdout, level + 1,
-                              func);
+              recursReaddirF (m, n, tmp, prefix, saved_stdout,
+                              level + 1, func);
             sprintf (levels1, "%d", level);
             setMapInMaps (m, "lenv", "level", levels1);
@@ -308,6 +295,6 @@
               }
 #ifdef DEBUG
-            fprintf (stderr, "#################\n%s\n#################\n",
-                     tmps1);
+            fprintf (stderr,
+                     "#################\n%s\n#################\n", tmps1);
 #endif
             t = readServiceFile (m, tmps1, &s1, dp->d_name);
@@ -318,8 +305,12 @@
                 char tmp01[1024];
                 if (tmp00 != NULL)
-                  sprintf (tmp01, _("Unable to parse the ZCFG file: %s (%s)"),
+                  sprintf (tmp01,
+                           _
+                           ("Unable to parse the ZCFG file: %s (%s)"),
                            dp->d_name, tmp00->value);
                 else
-                  sprintf (tmp01, _("Unable to parse the ZCFG file: %s."),
+                  sprintf (tmp01,
+                           _
+                           ("Unable to parse the ZCFG file: %s."),
                            dp->d_name);
                 dup2 (saved_stdout, fileno (stdout));
@@ -511,6 +502,6 @@
               mapsToCharXXX (request_output_real_format, (char ***) outputs);
               *eres =
-                execute ((char ***) &main_conf[0], (char ***) &inputs[0],
-                         (char ***) &outputs[0]);
+                execute ((char ***) &main_conf[0],
+                         (char ***) &inputs[0], (char ***) &outputs[0]);
 #ifdef DEBUG
               fprintf (stderr, "Function run successfully \n");
@@ -524,5 +515,6 @@
 #ifdef WIN32
               errstr = GetLastError ();
-              fprintf (stderr, "Function %s failed to load because of %d\n",
+              fprintf (stderr,
+                       "Function %s failed to load because of %d\n",
                        r_inputs->value, errstr);
 #endif
@@ -556,11 +548,10 @@
                   free (tmpMsg);
 #ifdef DEBUG
-                  fprintf (stderr, "Function %s error %s\n", r_inputs->value,
-                           errstr);
+                  fprintf (stderr, "Function %s error %s\n",
+                           r_inputs->value, errstr);
 #endif
                   *eres = -1;
                   return;
                 }
-
 #ifdef DEBUG
 #ifdef WIN32
@@ -626,5 +617,6 @@
     {
       *eres =
-        zoo_java_support (&m, request_inputs, s1, &request_input_real_format,
+        zoo_java_support (&m, request_inputs, s1,
+                          &request_input_real_format,
                           &request_output_real_format);
     }
@@ -636,5 +628,6 @@
     {
       *eres =
-        zoo_php_support (&m, request_inputs, s1, &request_input_real_format,
+        zoo_php_support (&m, request_inputs, s1,
+                         &request_input_real_format,
                          &request_output_real_format);
     }
@@ -647,5 +640,6 @@
     {
       *eres =
-        zoo_perl_support (&m, request_inputs, s1, &request_input_real_format,
+        zoo_perl_support (&m, request_inputs, s1,
+                          &request_input_real_format,
                           &request_output_real_format);
     }
@@ -657,5 +651,6 @@
     {
       *eres =
-        zoo_js_support (&m, request_inputs, s1, &request_input_real_format,
+        zoo_js_support (&m, request_inputs, s1,
+                        &request_input_real_format,
                         &request_output_real_format);
     }
@@ -667,5 +662,6 @@
     {
       *eres =
-        zoo_ruby_support (&m, request_inputs, s1, &request_input_real_format,
+        zoo_ruby_support (&m, request_inputs, s1,
+                          &request_input_real_format,
                           &request_output_real_format);
     }
@@ -775,5 +771,6 @@
                       NULL,     // Thread handle not inheritable
                       FALSE,    // Set handle inheritance to FALSE
-                      CREATE_NO_WINDOW, // Apache won't wait until the end
+                      CREATE_NO_WINDOW, // Apache won't wait until 
+                      // the end
                       NULL,     // Use parent's environment block
                       NULL,     // Use parent's starting directory 
@@ -947,6 +944,6 @@
       else
         {
-          sprintf (tmpUrl, "http://%s:%s%s", cgiServerName, cgiServerPort,
-                   cgiScriptName);
+          sprintf (tmpUrl, "http://%s:%s%s", cgiServerName,
+                   cgiServerPort, cgiScriptName);
         }
 #ifdef DEBUG
@@ -1139,5 +1136,6 @@
           || strlen (r_inputs->name) == 0 || strlen (r_inputs->value) == 0)
         {
-          errorException (m, _("Mandatory <identifier> was not specified"),
+          errorException (m,
+                          _("Mandatory <identifier> was not specified"),
                           "MissingParameterValue", "identifier");
           freeMaps (&m);
@@ -1152,5 +1150,6 @@
       if (dirp == NULL)
         {
-          errorException (m, _("The specified path path doesn't exist."),
+          errorException (m,
+                          _("The specified path path doesn't exist."),
                           "InvalidParameterValue", conf_dir);
           freeMaps (&m);
@@ -1339,5 +1338,6 @@
           if (outputs_as_text == NULL)
             {
-              return errorException (m, _("Unable to allocate memory"),
+              return errorException (m,
+                                     _("Unable to allocate memory"),
                                      "InternalError", NULL);
             }
@@ -1354,5 +1354,7 @@
               if (outputs_as_text[i] == NULL)
                 {
-                  return errorException (m, _("Unable to allocate memory"),
+                  return errorException (m,
+                                         _
+                                         ("Unable to allocate memory"),
                                          "InternalError", NULL);
                 }
@@ -1398,6 +1400,6 @@
                       tmpn[strlen (tmpc) - strlen (tmpv)] = 0;
 #ifdef DEBUG
-                      fprintf (stderr, "OUTPUT DEF [%s]=[%s]\n", tmpn,
-                               tmpv + 1);
+                      fprintf (stderr, "OUTPUT DEF [%s]=[%s]\n",
+                               tmpn, tmpv + 1);
 #endif
                       if (tmp_output->content == NULL)
@@ -1444,5 +1446,6 @@
       else
         {
-          errorException (m, _("Parameter <DataInputs> was not specified"),
+          errorException (m,
+                          _("Parameter <DataInputs> was not specified"),
                           "MissingParameterValue", "DataInputs");
           freeMaps (&m);
@@ -1466,6 +1469,6 @@
         {
           char *tmp2 = url_decode (tmp1);
-          snprintf (cursor_input, (strlen (tmp2) + 1) * sizeof (char), "%s",
-                    tmp2);
+          snprintf (cursor_input, (strlen (tmp2) + 1) * sizeof (char),
+                    "%s", tmp2);
           free (tmp2);
           pToken = strtok (cursor_input, ";");
@@ -1494,5 +1497,6 @@
           if (inputs_as_text[i] == NULL)
             {
-              return errorException (m, _("Unable to allocate memory."),
+              return errorException (m,
+                                     _("Unable to allocate memory."),
                                      "InternalError", NULL);
             }
@@ -1535,5 +1539,6 @@
                     {
                       return errorException (m,
-                                             _("Unable to allocate memory."),
+                                             _
+                                             ("Unable to allocate memory."),
                                              "InternalError", NULL);
                     }
@@ -1553,10 +1558,11 @@
                 {
 #ifdef DEBUG
-                  fprintf (stderr, "*** KVP NON URL-ENCODED \n***%s***\n",
-                           tmpc);
+                  fprintf (stderr,
+                           "*** KVP NON URL-ENCODED \n***%s***\n", tmpc);
 #endif
                   char *tmpv1 = strstr (tmpc, "=");
 #ifdef DEBUG
-                  fprintf (stderr, "*** VALUE NON URL-ENCODED \n***%s***\n",
+                  fprintf (stderr,
+                           "*** VALUE NON URL-ENCODED \n***%s***\n",
                            tmpv1 + 1);
 #endif
@@ -1575,6 +1581,7 @@
                       map *lmap = getLastMap (tmpmaps->content);
                       char *tmpValue =
-                        (char *) malloc ((strlen (tmpv) + strlen (tmpc) + 1) *
-                                         sizeof (char));
+                        (char *)
+                        malloc ((strlen (tmpv) + strlen (tmpc) +
+                                 1) * sizeof (char));
                       sprintf (tmpValue, "%s@%s", tmpv + 1, tmpc);
                       free (lmap->value);
@@ -1585,7 +1592,8 @@
                     }
 #ifdef DEBUG
-                  fprintf (stderr, "*** NAME NON URL-ENCODED \n***%s***\n",
-                           tmpn1);
-                  fprintf (stderr, "*** VALUE NON URL-ENCODED \n***%s***\n",
+                  fprintf (stderr,
+                           "*** NAME NON URL-ENCODED \n***%s***\n", tmpn1);
+                  fprintf (stderr,
+                           "*** VALUE NON URL-ENCODED \n***%s***\n",
                            tmpv1 + 1);
 #endif
@@ -1595,7 +1603,7 @@
                     {
                       char *tmpx2 = url_decode (tmpv1 + 1);
-                      if (strncasecmp (tmpx2, "http://", 7) != 0 &&
-                          strncasecmp (tmpx2, "ftp://", 6) != 0 &&
-                          strncasecmp (tmpx2, "https://", 8) != 0)
+                      if (strncasecmp (tmpx2, "http://", 7) != 0
+                          && strncasecmp (tmpx2, "ftp://", 6) != 0
+                          && strncasecmp (tmpx2, "https://", 8) != 0)
                         {
                           char emsg[1024];
@@ -1650,6 +1658,6 @@
               else
                 {
-                  maps *testPresence =
-                    getMaps (request_input_real_format, tmpmaps->name);
+                  maps *testPresence = getMaps (request_input_real_format,
+                                                tmpmaps->name);
                   if (testPresence != NULL)
                     {
@@ -1659,6 +1667,6 @@
                         {
                           if (appendMapsToMaps
-                              (m, request_input_real_format, tmpmaps,
-                               elem) < 0)
+                              (m, request_input_real_format,
+                               tmpmaps, elem) < 0)
                             {
                               freeMaps (&m);
@@ -1735,6 +1743,7 @@
                        xmlStrlen (cur2->name)) == 0)
                     {
-                      xmlChar *val =
-                        xmlNodeListGetString (doc, cur2->xmlChildrenNode, 1);
+                      xmlChar *val = xmlNodeListGetString (doc,
+                                                           cur2->xmlChildrenNode,
+                                                           1);
                       if (tmpmaps == NULL)
                         {
@@ -1759,9 +1768,11 @@
                       (cur2->name, BAD_CAST "Title",
                        xmlStrlen (cur2->name)) == 0
-                      || xmlStrncasecmp (cur2->name, BAD_CAST "Abstract",
+                      || xmlStrncasecmp (cur2->name,
+                                         BAD_CAST "Abstract",
                                          xmlStrlen (cur2->name)) == 0)
                     {
-                      xmlChar *val =
-                        xmlNodeListGetString (doc, cur2->xmlChildrenNode, 1);
+                      xmlChar *val = xmlNodeListGetString (doc,
+                                                           cur2->xmlChildrenNode,
+                                                           1);
                       if (tmpmaps == NULL)
                         {
@@ -1807,5 +1818,6 @@
 #endif
                       const char *refs[5] =
-                        { "mimeType", "encoding", "schema", "method",
+                        { "mimeType", "encoding", "schema",
+                        "method",
                         "href"
                       };
@@ -1815,25 +1827,29 @@
                           fprintf (stderr, "*** %s ***", refs[l]);
 #endif
-                          xmlChar *val = xmlGetProp (cur2, BAD_CAST refs[l]);
+                          xmlChar *val = xmlGetProp (cur2,
+                                                     BAD_CAST refs[l]);
                           if (val != NULL && xmlStrlen (val) > 0)
                             {
                               if (tmpmaps->content != NULL)
-                                addToMap (tmpmaps->content, refs[l],
-                                          (char *) val);
+                                addToMap (tmpmaps->content,
+                                          refs[l], (char *) val);
                               else
                                 tmpmaps->content =
                                   createMap (refs[l], (char *) val);
-                              map *ltmp = getMap (tmpmaps->content, "method");
+                              map *ltmp = getMap (tmpmaps->content,
+                                                  "method");
                               if (l == 4)
                                 {
                                   if (!
                                       (ltmp != NULL
-                                       && strncmp (ltmp->value, "POST",
+                                       && strncmp (ltmp->value,
+                                                   "POST",
                                                    4) == 0)
                                       && CHECK_INET_HANDLE (hInternet))
                                     {
                                       if (loadRemoteFile
-                                          (&m, &tmpmaps->content, &hInternet,
-                                           (char *) val) != 0)
+                                          (&m,
+                                           &tmpmaps->content,
+                                           &hInternet, (char *) val) != 0)
                                         {
                                           freeMaps (&m);
@@ -1859,13 +1875,11 @@
 #endif
                       xmlNodePtr cur3 = cur2->children;
-                      /*      HINTERNET hInternetP;
-                         hInternetP=InternetOpen(
-                         #ifndef WIN32
-                         (LPCTSTR)
-                         #endif
-                         "ZooWPSClient\0",
-                         INTERNET_OPEN_TYPE_PRECONFIG,
-                         NULL,NULL, 0); */
-                      //hInternet.ihandle[hInternet.nb].header=NULL;
+                      /*
+                       * HINTERNET hInternetP; hInternetP=InternetOpen(
+                       * #ifndef WIN32 (LPCTSTR) #endif
+                       * "ZooWPSClient\0", INTERNET_OPEN_TYPE_PRECONFIG,
+                       * NULL,NULL, 0); 
+                       */
+                      // hInternet.ihandle[hInternet.nb].header=NULL;
                       while (cur3 != NULL)
                         {
@@ -1875,6 +1889,6 @@
                           if (cur3 == NULL)
                             break;
-                          if (xmlStrcasecmp (cur3->name, BAD_CAST "Header") ==
-                              0)
+                          if (xmlStrcasecmp
+                              (cur3->name, BAD_CAST "Header") == 0)
                             {
                               const char *ha[2];
@@ -1886,9 +1900,11 @@
                               for (hai = 0; hai < 2; hai++)
                                 {
-                                  xmlChar *val =
-                                    xmlGetProp (cur3, BAD_CAST ha[hai]);
+                                  xmlChar *val = xmlGetProp (cur3,
+                                                             BAD_CAST
+                                                             ha[hai]);
 #ifdef POST_DEBUG
-                                  fprintf (stderr, "%s = %s\n", ha[hai],
-                                           (char *) val);
+                                  fprintf (stderr,
+                                           "%s = %s\n",
+                                           ha[hai], (char *) val);
 #endif
                                   if (hai == 0)
@@ -1898,21 +1914,26 @@
                                   else
                                     {
-                                      has =
-                                        (char *)
-                                        malloc ((4 + xmlStrlen (val) +
-                                                 strlen (key)) *
-                                                sizeof (char));
+                                      has = (char *)
+                                        malloc ((4 +
+                                                 xmlStrlen
+                                                 (val) +
+                                                 strlen
+                                                 (key)) * sizeof (char));
                                       if (has == NULL)
                                         {
-                                          return errorException (m,
-                                                                 _
-                                                                 ("Unable to allocate memory."),
-                                                                 "InternalError",
-                                                                 NULL);
+                                          return
+                                            errorException
+                                            (m,
+                                             _
+                                             ("Unable to allocate memory."),
+                                             "InternalError", NULL);
                                         }
                                       snprintf (has,
-                                                (3 + xmlStrlen (val) +
-                                                 strlen (key)), "%s: %s", key,
-                                                (char *) val);
+                                                (3 +
+                                                 xmlStrlen
+                                                 (val) +
+                                                 strlen
+                                                 (key)),
+                                                "%s: %s", key, (char *) val);
                                       free (key);
 #ifdef POST_DEBUG
@@ -1923,7 +1944,6 @@
                                 }
                               hInternet.ihandle[hInternet.nb].header =
-                                curl_slist_append (hInternet.ihandle
-                                                   [hInternet.nb].header,
-                                                   has);
+                                curl_slist_append
+                                (hInternet.ihandle[hInternet.nb].header, has);
                               if (has != NULL)
                                 free (has);
@@ -1935,14 +1955,16 @@
                                        "Try to fetch the body part of the request ...\n");
 #endif
-                              if (xmlStrcasecmp (cur3->name, BAD_CAST "Body")
-                                  == 0)
+                              if (xmlStrcasecmp
+                                  (cur3->name, BAD_CAST "Body") == 0)
                                 {
 #ifdef POST_DEBUG
-                                  fprintf (stderr, "Body part found !!!\n",
+                                  fprintf (stderr,
+                                           "Body part found !!!\n",
                                            (char *) cur3->content);
 #endif
                                   char *tmp =
-                                    (char *) malloc (cgiContentLength +
-                                                     1 * sizeof (char));
+                                    (char *)
+                                    malloc
+                                    (cgiContentLength + 1 * sizeof (char));
                                   memset (tmp, 0, cgiContentLength);
                                   xmlNodePtr cur4 = cur3->children;
@@ -1970,38 +1992,35 @@
                                       xmlFreeDoc (bdoc);
                                     }
-                                  map *btmp =
-                                    getMap (tmpmaps->content, "href");
+                                  map *btmp = getMap (tmpmaps->content,
+                                                      "href");
                                   if (btmp != NULL)
                                     {
 #ifdef POST_DEBUG
-                                      fprintf (stderr, "%s %s\n", btmp->value,
-                                               tmp);
-                                      curl_easy_setopt (hInternet.handle,
-                                                        CURLOPT_VERBOSE, 1);
-#endif
-                                      hInternet.waitingRequests[hInternet.
-                                                                nb] =
-                                        strdup (tmp);
-                                      InternetOpenUrl (&hInternet,
-                                                       btmp->value,
-                                                       hInternet.
-                                                       waitingRequests
-                                                       [hInternet.nb],
-                                                       strlen (hInternet.
-                                                               waitingRequests
-                                                               [hInternet.
-                                                                nb]),
-                                                       INTERNET_FLAG_NO_CACHE_WRITE,
-                                                       0);
+                                      fprintf (stderr,
+                                               "%s %s\n", btmp->value, tmp);
+                                      curl_easy_setopt
+                                        (hInternet.handle,
+                                         CURLOPT_VERBOSE, 1);
+#endif
+                                      hInternet.waitingRequests
+                                        [hInternet.nb] = strdup (tmp);
+                                      InternetOpenUrl
+                                        (&hInternet,
+                                         btmp->value,
+                                         hInternet.waitingRequests
+                                         [hInternet.nb],
+                                         strlen
+                                         (hInternet.waitingRequests
+                                          [hInternet.nb]),
+                                         INTERNET_FLAG_NO_CACHE_WRITE, 0);
                                     }
                                   free (tmp);
                                 }
-                              else
-                                if (xmlStrcasecmp
-                                    (cur3->name,
-                                     BAD_CAST "BodyReference") == 0)
+                              else if (xmlStrcasecmp
+                                       (cur3->name,
+                                        BAD_CAST "BodyReference") == 0)
                                 {
-                                  xmlChar *val =
-                                    xmlGetProp (cur3, BAD_CAST "href");
+                                  xmlChar *val = xmlGetProp (cur3,
+                                                             BAD_CAST "href");
                                   HINTERNET bInternet, res1;
                                   bInternet = InternetOpen (
@@ -2016,58 +2035,57 @@
                                              "WARNING : hInternet handle failed to initialize");
 #ifdef POST_DEBUG
-                                  curl_easy_setopt (bInternet.handle,
-                                                    CURLOPT_VERBOSE, 1);
+                                  curl_easy_setopt
+                                    (bInternet.handle, CURLOPT_VERBOSE, 1);
 #endif
                                   bInternet.waitingRequests[0] =
                                     strdup ((char *) val);
                                   res1 =
-                                    InternetOpenUrl (&bInternet,
-                                                     bInternet.waitingRequests
-                                                     [0], NULL, 0,
-                                                     INTERNET_FLAG_NO_CACHE_WRITE,
-                                                     0);
+                                    InternetOpenUrl
+                                    (&bInternet,
+                                     bInternet.waitingRequests
+                                     [0], NULL, 0,
+                                     INTERNET_FLAG_NO_CACHE_WRITE, 0);
                                   processDownloads (&bInternet);
                                   char *tmp =
                                     (char *)
-                                    malloc ((bInternet.ihandle[0].nDataLen +
-                                             1) * sizeof (char));
+                                    malloc ((bInternet.ihandle
+                                             [0].nDataLen
+                                             + 1) * sizeof (char));
                                   if (tmp == NULL)
                                     {
-                                      return errorException (m,
-                                                             _
-                                                             ("Unable to allocate memory."),
-                                                             "InternalError",
-                                                             NULL);
+                                      return
+                                        errorException
+                                        (m,
+                                         _
+                                         ("Unable to allocate memory."),
+                                         "InternalError", NULL);
                                     }
                                   size_t bRead;
-                                  InternetReadFile (bInternet.ihandle[0],
-                                                    (LPVOID) tmp,
-                                                    bInternet.ihandle[0].
-                                                    nDataLen, &bRead);
+                                  InternetReadFile
+                                    (bInternet.ihandle[0],
+                                     (LPVOID) tmp,
+                                     bInternet.ihandle[0].nDataLen, &bRead);
                                   tmp[bInternet.ihandle[0].nDataLen] = 0;
                                   InternetCloseHandle (&bInternet);
-                                  map *btmp =
-                                    getMap (tmpmaps->content, "href");
+                                  map *btmp = getMap (tmpmaps->content,
+                                                      "href");
                                   if (btmp != NULL)
                                     {
 #ifdef POST_DEBUG
-                                      fprintf (stderr, "%s %s\n", btmp->value,
-                                               tmp);
-#endif
-                                      hInternet.waitingRequests[hInternet.
-                                                                nb] =
-                                        strdup (tmp);
+                                      fprintf (stderr,
+                                               "%s %s\n", btmp->value, tmp);
+#endif
+                                      hInternet.waitingRequests
+                                        [hInternet.nb] = strdup (tmp);
                                       res =
-                                        InternetOpenUrl (&hInternet,
-                                                         btmp->value,
-                                                         hInternet.
-                                                         waitingRequests
-                                                         [hInternet.nb],
-                                                         strlen (hInternet.
-                                                                 waitingRequests
-                                                                 [hInternet.
-                                                                  nb]),
-                                                         INTERNET_FLAG_NO_CACHE_WRITE,
-                                                         0);
+                                        InternetOpenUrl
+                                        (&hInternet,
+                                         btmp->value,
+                                         hInternet.waitingRequests
+                                         [hInternet.nb],
+                                         strlen
+                                         (hInternet.waitingRequests
+                                          [hInternet.nb]),
+                                         INTERNET_FLAG_NO_CACHE_WRITE, 0);
                                     }
                                   free (tmp);
@@ -2082,5 +2100,6 @@
 #ifdef DEBUG
                       dumpMap (tmpmaps->content);
-                      fprintf (stderr, "= element 2 node \"%s\" = (%s)\n",
+                      fprintf (stderr,
+                               "= element 2 node \"%s\" = (%s)\n",
                                cur2->name, cur2->content);
 #endif
@@ -2112,15 +2131,17 @@
                                 {
 #ifdef DEBUG
-                                  fprintf (stderr, "*** LiteralData %s ***",
-                                           list[l]);
-#endif
-                                  xmlChar *val =
-                                    xmlGetProp (cur4, BAD_CAST list[l]);
+                                  fprintf (stderr,
+                                           "*** LiteralData %s ***", list[l]);
+#endif
+                                  xmlChar *val = xmlGetProp (cur4,
+                                                             BAD_CAST
+                                                             list[l]);
                                   if (val != NULL
                                       && strlen ((char *) val) > 0)
                                     {
                                       if (tmpmaps->content != NULL)
-                                        addToMap (tmpmaps->content, list[l],
-                                                  (char *) val);
+                                        addToMap
+                                          (tmpmaps->content,
+                                           list[l], (char *) val);
                                       else
                                         tmpmaps->content =
@@ -2134,7 +2155,6 @@
                                 }
                             }
-                          else
-                            if (xmlStrcasecmp
-                                (cur4->name, BAD_CAST "ComplexData") == 0)
+                          else if (xmlStrcasecmp
+                                   (cur4->name, BAD_CAST "ComplexData") == 0)
                             {
                 /**
@@ -2142,20 +2162,24 @@
 		 * mimeType, encoding, schema
 		 */
-                              const char *coms[3] =
-                                { "mimeType", "encoding", "schema" };
+                              const char *coms[3] = { "mimeType", "encoding",
+                                "schema"
+                              };
                               for (int l = 0; l < 3; l++)
                                 {
 #ifdef DEBUG
-                                  fprintf (stderr, "*** ComplexData %s ***\n",
+                                  fprintf (stderr,
+                                           "*** ComplexData %s ***\n",
                                            coms[l]);
 #endif
-                                  xmlChar *val =
-                                    xmlGetProp (cur4, BAD_CAST coms[l]);
+                                  xmlChar *val = xmlGetProp (cur4,
+                                                             BAD_CAST
+                                                             coms[l]);
                                   if (val != NULL
                                       && strlen ((char *) val) > 0)
                                     {
                                       if (tmpmaps->content != NULL)
-                                        addToMap (tmpmaps->content, coms[l],
-                                                  (char *) val);
+                                        addToMap
+                                          (tmpmaps->content,
+                                           coms[l], (char *) val);
                                       else
                                         tmpmaps->content =
@@ -2169,10 +2193,11 @@
                             }
 
-                          map *test = getMap (tmpmaps->content, "encoding");
+                          map *test = getMap (tmpmaps->content,
+                                              "encoding");
                           if (test == NULL)
                             {
                               if (tmpmaps->content != NULL)
-                                addToMap (tmpmaps->content, "encoding",
-                                          "utf-8");
+                                addToMap (tmpmaps->content,
+                                          "encoding", "utf-8");
                               else
                                 tmpmaps->content =
@@ -2184,15 +2209,18 @@
                             {
                               xmlChar *mv = xmlNodeListGetString (doc,
-                                                                  cur4->xmlChildrenNode,
+                                                                  cur4->
+                                                                  xmlChildrenNode,
                                                                   1);
-                              map *ltmp =
-                                getMap (tmpmaps->content, "mimeType");
+                              map *ltmp = getMap (tmpmaps->content,
+                                                  "mimeType");
                               if (mv == NULL
                                   ||
                                   (xmlStrcasecmp
-                                   (cur4->name, BAD_CAST "ComplexData") == 0
-                                   && (ltmp == NULL
-                                       || strncasecmp (ltmp->value,
-                                                       "text/xml", 8) == 0)))
+                                   (cur4->name,
+                                    BAD_CAST "ComplexData") ==
+                                   0 && (ltmp == NULL
+                                         ||
+                                         strncasecmp (ltmp->value,
+                                                      "text/xml", 8) == 0)))
                                 {
                                   xmlDocPtr doc1 = xmlNewDoc (BAD_CAST "1.0");
@@ -2200,5 +2228,6 @@
                                   xmlNodePtr cur5 = cur4->children;
                                   while (cur5 != NULL
-                                         && cur5->type != XML_ELEMENT_NODE
+                                         && cur5->type !=
+                                         XML_ELEMENT_NODE
                                          && cur5->type !=
                                          XML_CDATA_SECTION_NODE)
@@ -2208,11 +2237,10 @@
                                     {
                                       xmlDocSetRootElement (doc1, cur5);
-                                      xmlDocDumpFormatMemoryEnc (doc1, &mv,
-                                                                 &buffersize,
-                                                                 "utf-8", 1);
+                                      xmlDocDumpFormatMemoryEnc
+                                        (doc1, &mv, &buffersize, "utf-8", 1);
                                       char size[1024];
                                       sprintf (size, "%d", buffersize);
-                                      addToMap (tmpmaps->content, "size",
-                                                size);
+                                      addToMap (tmpmaps->content,
+                                                "size", size);
                                       xmlFreeDoc (doc1);
                                     }
@@ -2220,6 +2248,6 @@
                               if (mv != NULL)
                                 {
-                                  addToMap (tmpmaps->content, "value",
-                                            (char *) mv);
+                                  addToMap (tmpmaps->content,
+                                            "value", (char *) mv);
                                   xmlFree (mv);
                                 }
@@ -2231,11 +2259,12 @@
                                                                       xmlChildrenNode,
                                                                       0);
-                              addToMap (tmpmaps->content, "value",
-                                        (char *) tmp);
-                              map *tmpv = getMap (tmpmaps->content, "value");
+                              addToMap (tmpmaps->content,
+                                        "value", (char *) tmp);
+                              map *tmpv = getMap (tmpmaps->content,
+                                                  "value");
                               char *res = NULL;
                               char *curs = tmpv->value;
-                              for (int i = 0; i <= strlen (tmpv->value) / 64;
-                                   i++)
+                              for (int i = 0;
+                                   i <= strlen (tmpv->value) / 64; i++)
                                 {
                                   if (res == NULL)
@@ -2244,7 +2273,9 @@
                                   else
                                     res =
-                                      (char *) realloc (res,
-                                                        (((i + 1) * 65) +
-                                                         i) * sizeof (char));
+                                      (char *)
+                                      realloc (res,
+                                               (((i +
+                                                  1) *
+                                                 65) + i) * sizeof (char));
                                   int csize = i * 65;
                                   strncpy (res + csize, curs, 64);
@@ -2253,6 +2284,7 @@
                                   else
                                     {
-                                      strncpy (res + (((i + 1) * 64) + i),
-                                               "\n\0", 2);
+                                      strncpy (res +
+                                               (((i +
+                                                  1) * 64) + i), "\n\0", 2);
                                       curs += 64;
                                     }
@@ -2278,6 +2310,6 @@
 
               {
-                maps *testPresence =
-                  getMaps (request_input_real_format, tmpmaps->name);
+                maps *testPresence = getMaps (request_input_real_format,
+                                              tmpmaps->name);
                 if (testPresence != NULL)
                   {
@@ -2346,5 +2378,7 @@
               if (tmpmaps == NULL)
                 {
-                  return errorException (m, _("Unable to allocate memory."),
+                  return errorException (m,
+                                         _
+                                         ("Unable to allocate memory."),
                                          "InternalError", NULL);
                 }
@@ -2370,6 +2404,6 @@
                         {
                           if (tmpmaps->content != NULL)
-                            addToMap (tmpmaps->content, outs[l],
-                                      (char *) val);
+                            addToMap (tmpmaps->content,
+                                      outs[l], (char *) val);
                           else
                             tmpmaps->content =
@@ -2389,6 +2423,7 @@
                        xmlStrlen (cur2->name)) == 0)
                     {
-                      xmlChar *val =
-                        xmlNodeListGetString (NULL, cur2->xmlChildrenNode, 1);
+                      xmlChar *val = xmlNodeListGetString (NULL,
+                                                           cur2->xmlChildrenNode,
+                                                           1);
                       free (tmpmaps->name);
                       tmpmaps->name = zStrdup ((char *) val);
@@ -2413,5 +2448,5 @@
         for (int k = 0; k < tmps->nodeNr; k++)
           {
-            //else
+            // else
             addToMap (request_inputs, "ResponseDocument", "");
             maps *tmpmaps = NULL;
@@ -2475,7 +2510,7 @@
                          xmlStrlen (cur1->name)) == 0)
                       {
-                        xmlChar *val =
-                          xmlNodeListGetString (doc, cur1->xmlChildrenNode,
-                                                1);
+                        xmlChar *val = xmlNodeListGetString (doc,
+                                                             cur1->xmlChildrenNode,
+                                                             1);
                         if (tmpmaps == NULL)
                           {
@@ -2498,24 +2533,24 @@
                           }
                         if (asRaw == true)
-                          addToMap (request_inputs, "RawDataOutput",
-                                    (char *) val);
+                          addToMap (request_inputs,
+                                    "RawDataOutput", (char *) val);
                         else
                           {
                             if (cur1cnt == 0)
-                              addToMap (request_inputs, "ResponseDocument",
-                                        (char *) val);
+                              addToMap (request_inputs,
+                                        "ResponseDocument", (char *) val);
                             else
                               {
-                                map *tt =
-                                  getMap (request_inputs, "ResponseDocument");
+                                map *tt = getMap (request_inputs,
+                                                  "ResponseDocument");
                                 char *tmp = zStrdup (tt->value);
                                 free (tt->value);
-                                tt->value =
-                                  (char *)
+                                tt->value = (char *)
                                   malloc ((strlen (tmp) +
-                                           strlen ((char *) val) +
-                                           1) * sizeof (char));
-                                sprintf (tt->value, "%s;%s", tmp,
-                                         (char *) val);
+                                           strlen ((char
+                                                    *)
+                                                   val) + 1) * sizeof (char));
+                                sprintf (tt->value, "%s;%s",
+                                         tmp, (char *) val);
                                 free (tmp);
                               }
@@ -2527,14 +2562,15 @@
 	     * Title, Asbtract
 	     */
-                    else
-                      if (xmlStrncasecmp
-                          (cur1->name, BAD_CAST "Title",
-                           xmlStrlen (cur1->name)) == 0
-                          || xmlStrncasecmp (cur1->name, BAD_CAST "Abstract",
-                                             xmlStrlen (cur1->name)) == 0)
+                    else if (xmlStrncasecmp
+                             (cur1->name, BAD_CAST "Title",
+                              xmlStrlen (cur1->name)) == 0
+                             || xmlStrncasecmp (cur1->name,
+                                                BAD_CAST
+                                                "Abstract",
+                                                xmlStrlen (cur1->name)) == 0)
                       {
-                        xmlChar *val =
-                          xmlNodeListGetString (doc, cur1->xmlChildrenNode,
-                                                1);
+                        xmlChar *val = xmlNodeListGetString (doc,
+                                                             cur1->xmlChildrenNode,
+                                                             1);
                         if (tmpmaps == NULL)
                           {
@@ -2555,6 +2591,6 @@
                           {
                             if (tmpmaps->content != NULL)
-                              addToMap (tmpmaps->content, (char *) cur1->name,
-                                        (char *) val);
+                              addToMap (tmpmaps->content,
+                                        (char *) cur1->name, (char *) val);
                             else
                               tmpmaps->content =
@@ -2563,8 +2599,7 @@
                         xmlFree (val);
                       }
-                    else
-                      if (xmlStrncasecmp
-                          (cur1->name, BAD_CAST "Output",
-                           xmlStrlen (cur1->name)) == 0)
+                    else if (xmlStrncasecmp
+                             (cur1->name, BAD_CAST "Output",
+                              xmlStrlen (cur1->name)) == 0)
                       {
               /**
@@ -2573,5 +2608,6 @@
 	       */
                         const char *outs[5] =
-                          { "mimeType", "encoding", "schema", "uom",
+                          { "mimeType", "encoding", "schema",
+                          "uom",
                           "asReference"
                         };
@@ -2581,11 +2617,11 @@
                             fprintf (stderr, "*** %s ***\t", outs[l]);
 #endif
-                            xmlChar *val =
-                              xmlGetProp (cur1, BAD_CAST outs[l]);
+                            xmlChar *val = xmlGetProp (cur1,
+                                                       BAD_CAST outs[l]);
                             if (val != NULL && strlen ((char *) val) > 0)
                               {
                                 if (tmpmaps->content != NULL)
-                                  addToMap (tmpmaps->content, outs[l],
-                                            (char *) val);
+                                  addToMap (tmpmaps->content,
+                                            outs[l], (char *) val);
                                 else
                                   tmpmaps->content =
@@ -2606,9 +2642,11 @@
 		 */
                             if (xmlStrncasecmp
-                                (cur2->name, BAD_CAST "Identifier",
+                                (cur2->name,
+                                 BAD_CAST "Identifier",
                                  xmlStrlen (cur2->name)) == 0)
                               {
                                 xmlChar *val = xmlNodeListGetString (doc,
-                                                                     cur2->xmlChildrenNode,
+                                                                     cur2->
+                                                                     xmlChildrenNode,
                                                                      1);
                                 if (tmpmaps == NULL)
@@ -2617,9 +2655,10 @@
                                     if (tmpmaps == NULL)
                                       {
-                                        return errorException (m,
-                                                               _
-                                                               ("Unable to allocate memory."),
-                                                               "InternalError",
-                                                               NULL);
+                                        return
+                                          errorException
+                                          (m,
+                                           _
+                                           ("Unable to allocate memory."),
+                                           "InternalError", NULL);
                                       }
                                     tmpmaps->name = zStrdup ((char *) val);
@@ -2638,15 +2677,17 @@
 		 * Title, Asbtract
 		 */
-                            else
-                              if (xmlStrncasecmp
-                                  (cur2->name, BAD_CAST "Title",
-                                   xmlStrlen (cur2->name)) == 0
-                                  || xmlStrncasecmp (cur2->name,
-                                                     BAD_CAST "Abstract",
-                                                     xmlStrlen (cur2->name))
-                                  == 0)
+                            else if (xmlStrncasecmp
+                                     (cur2->name,
+                                      BAD_CAST "Title",
+                                      xmlStrlen (cur2->name)) == 0
+                                     || xmlStrncasecmp (cur2->name,
+                                                        BAD_CAST
+                                                        "Abstract",
+                                                        xmlStrlen
+                                                        (cur2->name)) == 0)
                               {
                                 xmlChar *val = xmlNodeListGetString (doc,
-                                                                     cur2->xmlChildrenNode,
+                                                                     cur2->
+                                                                     xmlChildrenNode,
                                                                      1);
                                 if (tmpmaps == NULL)
@@ -2655,15 +2696,17 @@
                                     if (tmpmaps == NULL)
                                       {
-                                        return errorException (m,
-                                                               _
-                                                               ("Unable to allocate memory."),
-                                                               "InternalError",
-                                                               NULL);
+                                        return
+                                          errorException
+                                          (m,
+                                           _
+                                           ("Unable to allocate memory."),
+                                           "InternalError", NULL);
                                       }
                                     tmpmaps->name =
                                       zStrdup ("missingIndetifier");
                                     tmpmaps->content =
-                                      createMap ((char *) cur2->name,
-                                                 (char *) val);
+                                      createMap ((char
+                                                  *)
+                                                 cur2->name, (char *) val);
                                     tmpmaps->next = NULL;
                                   }
@@ -2671,7 +2714,7 @@
                                   {
                                     if (tmpmaps->content != NULL)
-                                      addToMap (tmpmaps->content,
-                                                (char *) cur2->name,
-                                                (char *) val);
+                                      addToMap
+                                        (tmpmaps->content,
+                                         (char *) cur2->name, (char *) val);
                                     else
                                       tmpmaps->content =
@@ -2710,5 +2753,5 @@
   runHttpRequests (&m, &request_input_real_format, &hInternet);
 
-  //  if(CHECK_INET_HANDLE(hInternet))
+  // if(CHECK_INET_HANDLE(hInternet))
   InternetCloseHandle (&hInternet);
 
@@ -2845,6 +2888,6 @@
                   strcpy (fileNameOnServer, name + t + 1);
 
-                  sprintf (storageNameOnServer, "%s/%s", path->value,
-                           fileNameOnServer);
+                  sprintf (storageNameOnServer, "%s/%s",
+                           path->value, fileNameOnServer);
 #ifdef DEBUG
                   fprintf (stderr, "Name on server %s\n",
@@ -2854,10 +2897,12 @@
 #endif
                   targetFile =
-                    open (storageNameOnServer, O_RDWR | O_CREAT | O_TRUNC,
+                    open (storageNameOnServer,
+                          O_RDWR | O_CREAT | O_TRUNC,
                           S_IRWXU | S_IRGRP | S_IROTH);
                   if (targetFile < 0)
                     {
 #ifdef DEBUG
-                      fprintf (stderr, "could not create the new file,%s\n",
+                      fprintf (stderr,
+                               "could not create the new file,%s\n",
                                fileNameOnServer);
 #endif
@@ -2865,5 +2910,6 @@
                   else
                     {
-                      while (cgiFormFileRead (file, buffer, BufferLen, &got)
+                      while (cgiFormFileRead
+                             (file, buffer, BufferLen, &got)
                              == cgiFormSuccess)
                         {
@@ -2915,64 +2961,48 @@
             }
 #ifdef DEBUG
+          if (SetEnvironmentVariable (mapcs->name, mapcs->value) == 0)
+            {
+              fflush (stderr);
+              fprintf (stderr, "setting variable... %s\n", "OK");
+            }
+          else
+            {
+              fflush (stderr);
+              fprintf (stderr, "setting variable... %s\n", "OK");
+            }
+#else
+
+
+          SetEnvironmentVariable (mapcs->name, mapcs->value);
+#endif
+          char *toto =
+            (char
+             *) malloc ((strlen
+                         (mapcs->name) +
+                         strlen (mapcs->value) + 2) * sizeof (char));
+          sprintf (toto, "%s=%s", mapcs->name, mapcs->value);
+          putenv (toto);
+#ifdef DEBUG
           fflush (stderr);
-          fprintf (stderr, "setting variable... %s\n", (
-#endif
-                                                         SetEnvironmentVariable
-                                                         (mapcs->name,
-                                                          mapcs->value)
-#ifdef DEBUG
-                                                         == 0) ? "OK" :
-                   "FAILED");
-#else
-                                                         ;
-#endif
-                                                         char *toto =
-                                                         (char
-                                                          *)malloc ((strlen
-                                                                     (mapcs->
-                                                                      name) +
-                                                                     strlen
-                                                                     (mapcs->
-                                                                      value) +
-                                                                     2) *
-                                                                    sizeof
-                                                                    (char));
-                                                         sprintf (toto,
-                                                                  "%s=%s",
-                                                                  mapcs->name,
-                                                                  mapcs->
-                                                                  value);
-                                                         putenv (toto);
-#ifdef DEBUG
-                                                         fflush (stderr);
-#endif
-#endif
-#ifdef DEBUG
-                                                         fprintf (stderr,
-                                                                  "[ZOO: setenv (%s=%s)]\n",
-                                                                  mapcs->name,
-                                                                  mapcs->
-                                                                  value);
-                                                         fflush (stderr);
-#endif
-                                                         mapcs = mapcs->next;}
-                                                         }
-
-#ifdef DEBUG
-                                                         dumpMap
-                                                         (request_inputs);
+#endif
+#endif
+#ifdef DEBUG
+          fprintf (stderr,
+                   "[ZOO: setenv (%s=%s)]\n", mapcs->name, mapcs->value);
+          fflush (stderr);
+#endif
+          mapcs = mapcs->next;
+        }
+    }
+#ifdef DEBUG
+  dumpMap (request_inputs);
 #endif
   /**
    * Need to check if we need to fork to load a status enabled 
    */
-                                                         r_inputs = NULL;
-                                                         map * store =
-                                                         getMap
-                                                         (request_inputs,
-                                                          "storeExecuteResponse");
-                                                         map * status =
-                                                         getMap
-                                                         (request_inputs,
-                                                          "status");
+  r_inputs = NULL;
+  map *store = getMap (request_inputs,
+                       "storeExecuteResponse");
+  map *status = getMap (request_inputs, "status");
   /**
    * 05-007r7 WPS 1.0.0 page 57 :
@@ -2980,42 +3010,29 @@
    * shall raise an exception.'
    */
-                                                         if (status != NULL
-                                                             &&
-                                                             strcmp
-                                                             (status->value,
-                                                              "true") == 0
-                                                             && store != NULL
-                                                             &&
-                                                             strcmp
-                                                             (store->value,
-                                                              "false") == 0)
-                                                         {
-                                                         errorException (m,
-                                                                         _
-                                                                         ("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."),
-                                                                         "InvalidParameterValue",
-                                                                         "storeExecuteResponse");
-                                                         freeService (&s1);
-                                                         free (s1);
-                                                         freeMaps (&m);
-                                                         free (m);
-                                                         freeMaps
-                                                         (&request_input_real_format);
-                                                         free
-                                                         (request_input_real_format);
-                                                         freeMaps
-                                                         (&request_output_real_format);
-                                                         free
-                                                         (request_output_real_format);
-                                                         free (REQUEST);
-                                                         free (SERVICE_URL);
-                                                         return 1;}
-                                                         r_inputs =
-                                                         getMap
-                                                         (request_inputs,
-                                                          "storeExecuteResponse");
-                                                         int eres =
-                                                         SERVICE_STARTED;
-                                                         int cpid = getpid ();
+  if (status != NULL
+      &&
+      strcmp
+      (status->value,
+       "true") == 0 && store != NULL && strcmp (store->value, "false") == 0)
+    {
+      errorException (m,
+                      _
+                      ("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."),
+                      "InvalidParameterValue", "storeExecuteResponse");
+      freeService (&s1);
+      free (s1);
+      freeMaps (&m);
+      free (m);
+      freeMaps (&request_input_real_format);
+      free (request_input_real_format);
+      freeMaps (&request_output_real_format);
+      free (request_output_real_format);
+      free (REQUEST);
+      free (SERVICE_URL);
+      return 1;
+    }
+  r_inputs = getMap (request_inputs, "storeExecuteResponse");
+  int eres = SERVICE_STARTED;
+  int cpid = getpid ();
   /**
    * Initialize the specific [lenv] section which contains runtime variables:
@@ -3036,273 +3053,158 @@
    *
    */
-                                                         maps * _tmpMaps =
-                                                         (maps *)
-                                                         malloc (MAPS_SIZE);
-                                                         _tmpMaps->name =
-                                                         zStrdup ("lenv");
-                                                         char tmpBuff[100];
-                                                         sprintf (tmpBuff,
-                                                                  "%i",
-                                                                  (cpid +
-                                                                   (int)
-                                                                   time
-                                                                   (NULL)));
-                                                         _tmpMaps->content =
-                                                         createMap ("usid",
-                                                                    tmpBuff);
-                                                         _tmpMaps->next =
-                                                         NULL;
-                                                         sprintf (tmpBuff,
-                                                                  "%i", cpid);
-                                                         addToMap
-                                                         (_tmpMaps->content,
-                                                          "sid", tmpBuff);
-                                                         addToMap
-                                                         (_tmpMaps->content,
-                                                          "status", "0");
-                                                         addToMap
-                                                         (_tmpMaps->content,
-                                                          "cwd", ntmp);
-                                                         addToMap
-                                                         (_tmpMaps->content,
-                                                          "message",
-                                                          _
-                                                          ("No message provided"));
-                                                         map * ltmp =
-                                                         getMap
-                                                         (request_inputs,
-                                                          "soap");
-                                                         if (ltmp !=
-                                                             NULL)
-                                                         addToMap
-                                                         (_tmpMaps->content,
-                                                          "soap",
-                                                          ltmp->value);
-                                                         else
-                                                         addToMap
-                                                         (_tmpMaps->content,
-                                                          "soap", "false");
-                                                         if (cgiCookie != NULL
-                                                             &&
-                                                             strlen
-                                                             (cgiCookie) > 0)
-                                                         {
-                                                         int hasValidCookie =
-                                                         -1;
-                                                         char *tcook =
-                                                         zStrdup (cgiCookie);
-                                                         char *tmp = NULL;
-                                                         map * testing =
-                                                         getMapFromMaps (m,
-                                                                         "main",
-                                                                         "cookiePrefix");
-                                                         if (testing == NULL)
-                                                         {
-                                                         tmp =
-                                                         zStrdup ("ID=");}
-                                                         else
-                                                         {
-                                                         tmp =
-                                                         (char *)
-                                                         malloc ((strlen
-                                                                  (testing->
-                                                                   value) +
-                                                                  2) *
-                                                                 sizeof
-                                                                 (char));
-                                                         sprintf (tmp, "%s=",
-                                                                  testing->
-                                                                  value);}
-                                                         if (strstr
-                                                             (cgiCookie,
-                                                              ";") != NULL)
-                                                         {
-                                                         char *token,
-                                                         *saveptr;
-                                                         token =
-                                                         strtok_r (cgiCookie,
-                                                                   ";",
-                                                                   &saveptr);
-                                                         while (token != NULL)
-                                                         {
-                                                         if (strcasestr
-                                                             (token,
-                                                              tmp) != NULL)
-                                                         {
-                                                         if (tcook != NULL)
-                                                         free (tcook);
-                                                         tcook =
-                                                         zStrdup (token);
-                                                         hasValidCookie = 1;}
-                                                         token =
-                                                         strtok_r (NULL, ";",
-                                                                   &saveptr);}
-                                                         }
-                                                         else
-                                                         {
-                                                         if (strstr
-                                                             (cgiCookie,
-                                                              "=") != NULL
-                                                             &&
-                                                             strcasestr
-                                                             (cgiCookie,
-                                                              tmp) != NULL)
-                                                         {
-                                                         tcook =
-                                                         zStrdup (cgiCookie);
-                                                         hasValidCookie = 1;}
-                                                         if (tmp != NULL)
-                                                         {
-                                                         free (tmp);}
-                                                         }
-                                                         if (hasValidCookie >
-                                                             0)
-                                                         {
-                                                         addToMap
-                                                         (_tmpMaps->content,
-                                                          "sessid",
-                                                          strstr (tcook,
-                                                                  "=") + 1);
-                                                         char
-                                                         session_file_path
-                                                         [1024];
-                                                         map * tmpPath =
-                                                         getMapFromMaps (m,
-                                                                         "main",
-                                                                         "sessPath");
-                                                         if (tmpPath ==
-                                                             NULL) tmpPath =
-                                                         getMapFromMaps (m,
-                                                                         "main",
-                                                                         "tmpPath");
-                                                         char *tmp1 =
-                                                         strtok (tcook, ";");
-                                                         if (tmp1 !=
-                                                             NULL)
-                                                         sprintf
-                                                         (session_file_path,
-                                                          "%s/sess_%s.cfg",
-                                                          tmpPath->value,
-                                                          strstr (tmp1,
-                                                                  "=") + 1);
-                                                         else
-                                                         sprintf
-                                                         (session_file_path,
-                                                          "%s/sess_%s.cfg",
-                                                          tmpPath->value,
-                                                          strstr (cgiCookie,
-                                                                  "=") + 1);
-                                                         free (tcook);
-                                                         maps * tmpSess =
-                                                         (maps *)
-                                                         malloc (MAPS_SIZE);
-                                                         struct stat
-                                                         file_status;
-                                                         int istat =
-                                                         stat
-                                                         (session_file_path,
-                                                          &file_status);
-                                                         if (istat == 0
-                                                             &&
-                                                             file_status.
-                                                             st_size > 0)
-                                                         {
-                                                         conf_read
-                                                         (session_file_path,
-                                                          tmpSess);
-                                                         addMapsToMaps (&m,
-                                                                        tmpSess);
-                                                         freeMaps (&tmpSess);
-                                                         free (tmpSess);}
-                                                         }
-                                                         }
-                                                         addMapsToMaps (&m,
-                                                                        _tmpMaps);
-                                                         freeMaps (&_tmpMaps);
-                                                         free (_tmpMaps);
-#ifdef DEBUG
-                                                         dumpMap
-                                                         (request_inputs);
+  maps *_tmpMaps = (maps *) malloc (MAPS_SIZE);
+  _tmpMaps->name = zStrdup ("lenv");
+  char tmpBuff[100];
+  sprintf (tmpBuff, "%i", (cpid + (int) time (NULL)));
+  _tmpMaps->content = createMap ("usid", tmpBuff);
+  _tmpMaps->next = NULL;
+  sprintf (tmpBuff, "%i", cpid);
+  addToMap (_tmpMaps->content, "sid", tmpBuff);
+  addToMap (_tmpMaps->content, "status", "0");
+  addToMap (_tmpMaps->content, "cwd", ntmp);
+  addToMap (_tmpMaps->content, "message", _("No message provided"));
+  map *ltmp = getMap (request_inputs,
+                      "soap");
+  if (ltmp != NULL)
+    addToMap (_tmpMaps->content, "soap", ltmp->value);
+  else
+    addToMap (_tmpMaps->content, "soap", "false");
+  if (cgiCookie != NULL && strlen (cgiCookie) > 0)
+    {
+      int hasValidCookie = -1;
+      char *tcook = zStrdup (cgiCookie);
+      char *tmp = NULL;
+      map *testing = getMapFromMaps (m, "main", "cookiePrefix");
+      if (testing == NULL)
+        {
+          tmp = zStrdup ("ID=");
+        }
+      else
+        {
+          tmp =
+            (char *) malloc ((strlen (testing->value) + 2) * sizeof (char));
+          sprintf (tmp, "%s=", testing->value);
+        }
+      if (strstr (cgiCookie, ";") != NULL)
+        {
+          char *token, *saveptr;
+          token = strtok_r (cgiCookie, ";", &saveptr);
+          while (token != NULL)
+            {
+              if (strcasestr (token, tmp) != NULL)
+                {
+                  if (tcook != NULL)
+                    free (tcook);
+                  tcook = zStrdup (token);
+                  hasValidCookie = 1;
+                }
+              token = strtok_r (NULL, ";", &saveptr);
+            }
+        }
+      else
+        {
+          if (strstr
+              (cgiCookie, "=") != NULL && strcasestr (cgiCookie, tmp) != NULL)
+            {
+              tcook = zStrdup (cgiCookie);
+              hasValidCookie = 1;
+            }
+          if (tmp != NULL)
+            {
+              free (tmp);
+            }
+        }
+      if (hasValidCookie > 0)
+        {
+          addToMap (_tmpMaps->content, "sessid", strstr (tcook, "=") + 1);
+          char session_file_path[1024];
+          map *tmpPath = getMapFromMaps (m,
+                                         "main",
+                                         "sessPath");
+          if (tmpPath == NULL)
+            tmpPath = getMapFromMaps (m, "main", "tmpPath");
+          char *tmp1 = strtok (tcook, ";");
+          if (tmp1 != NULL)
+            sprintf
+              (session_file_path,
+               "%s/sess_%s.cfg", tmpPath->value, strstr (tmp1, "=") + 1);
+          else
+            sprintf
+              (session_file_path,
+               "%s/sess_%s.cfg", tmpPath->value, strstr (cgiCookie, "=") + 1);
+          free (tcook);
+          maps *tmpSess = (maps *) malloc (MAPS_SIZE);
+          struct stat file_status;
+          int istat = stat (session_file_path,
+                            &file_status);
+          if (istat == 0 && file_status.st_size > 0)
+            {
+              conf_read (session_file_path, tmpSess);
+              addMapsToMaps (&m, tmpSess);
+              freeMaps (&tmpSess);
+              free (tmpSess);
+            }
+        }
+    }
+  addMapsToMaps (&m, _tmpMaps);
+  freeMaps (&_tmpMaps);
+  free (_tmpMaps);
+#ifdef DEBUG
+  dumpMap (request_inputs);
 #endif
 #ifdef WIN32
-                                                         char *cgiSidL = NULL;
-                                                         if (getenv ("CGISID")
-                                                             !=
-                                                             NULL)
-                                                         addToMap
-                                                         (request_inputs,
-                                                          "cgiSid",
-                                                          getenv ("CGISID"));
-                                                         map * test1 =
-                                                         getMap
-                                                         (request_inputs,
-                                                          "cgiSid");
-                                                         if (test1 != NULL)
-                                                         {
-                                                         cgiSid =
-                                                         test1->value;
-                                                         addToMap
-                                                         (request_inputs,
-                                                          "storeExecuteResponse",
-                                                          "true");
-                                                         addToMap
-                                                         (request_inputs,
-                                                          "status", "true");
-                                                         setMapInMaps (m,
-                                                                       "lenv",
-                                                                       "sid",
-                                                                       test1->
-                                                                       value);
-                                                         status =
-                                                         getMap
-                                                         (request_inputs,
-                                                          "status");}
-#endif
-                                                         char *fbkp, *fbkp1;
-                                                         FILE * f0, *f1;
-                                                         if (status != NULL)
-                                                         if (strcasecmp
-                                                             (status->value,
-                                                              "false") ==
-                                                             0) status =
-                                                         NULLMAP;
-                                                         if (status ==
-                                                             NULLMAP)
-                                                         {
-                                                         loadServiceAndRun
-                                                         (&m, s1,
-                                                          request_inputs,
-                                                          &request_input_real_format,
-                                                          &request_output_real_format,
-                                                          &eres);}
-                                                         else
-                                                         {
-                                                         int pid;
-#ifdef DEBUG
-                                                         fprintf (stderr,
-                                                                  "\nPID : %d\n",
-                                                                  cpid);
+  char *cgiSidL = NULL;
+  if (getenv ("CGISID") != NULL)
+    addToMap (request_inputs, "cgiSid", getenv ("CGISID"));
+  map *test1 = getMap (request_inputs, "cgiSid");
+  if (test1 != NULL)
+    {
+      cgiSid = test1->value;
+      addToMap (request_inputs, "storeExecuteResponse", "true");
+      addToMap (request_inputs, "status", "true");
+      setMapInMaps (m, "lenv", "sid", test1->value);
+      status = getMap (request_inputs, "status");
+    }
+#endif
+  char *fbkp, *fbkp1;
+  FILE *f0, *f1;
+  if (status != NULL)
+    if (strcasecmp (status->value, "false") == 0)
+      status = NULLMAP;
+  if (status == NULLMAP)
+    {
+      loadServiceAndRun
+        (&m, s1,
+         request_inputs,
+         &request_input_real_format, &request_output_real_format, &eres);
+    }
+  else
+    {
+      int pid;
+#ifdef DEBUG
+      fprintf (stderr, "\nPID : %d\n", cpid);
 #endif
 #ifndef WIN32
-                                                         pid = fork ();
+      pid = fork ();
 #else
-                                                         if (cgiSid == NULL)
-                                                         {
-                                                         createProcess (m,
-                                                                        request_inputs,
-                                                                        s1,
-                                                                        NULL,
-                                                                        cpid,
-                                                                        request_input_real_format,
-                                                                        request_output_real_format);
-                                                         pid = cpid;}
-                                                         else
-                                                         {
-                                                         pid = 0;
-                                                         cpid =
-                                                         atoi (cgiSid);}
-#endif
-                                                         if (pid > 0)
-                                                         {
+      if (cgiSid == NULL)
+        {
+          createProcess (m,
+                         request_inputs,
+                         s1,
+                         NULL,
+                         cpid,
+                         request_input_real_format,
+                         request_output_real_format);
+          pid = cpid;
+        }
+      else
+        {
+          pid = 0;
+          cpid = atoi (cgiSid);
+        }
+#endif
+      if (pid > 0)
+        {
       /**
        * dady :
@@ -3310,82 +3212,43 @@
        */
 #ifdef DEBUG
-                                                         fprintf (stderr,
-                                                                  "father pid continue (origin %d) %d ...\n",
-                                                                  cpid,
-                                                                  getpid ());
-#endif
-                                                         eres =
-                                                         SERVICE_ACCEPTED;}
-                                                         else
-                                                         if (pid == 0)
-                                                         {
+          fprintf (stderr,
+                   "father pid continue (origin %d) %d ...\n",
+                   cpid, getpid ());
+#endif
+          eres = SERVICE_ACCEPTED;
+        }
+      else if (pid == 0)
+        {
       /**
        * son : have to close the stdout, stdin and stderr to let the parent
        * process answer to http client.
        */
-                                                         r_inputs =
-                                                         getMapFromMaps (m,
-                                                                         "main",
-                                                                         "tmpPath");
-                                                         map * r_inputs1 =
-                                                         getMap (s1->content,
-                                                                 "ServiceProvider");
-                                                         fbkp =
-                                                         (char *)
-                                                         malloc ((strlen
-                                                                  (r_inputs->
-                                                                   value) +
-                                                                  strlen
-                                                                  (r_inputs1->
-                                                                   value) +
-                                                                  1024) *
-                                                                 sizeof
-                                                                 (char));
-                                                         sprintf (fbkp,
-                                                                  "%s/%s_%d.xml",
-                                                                  r_inputs->
-                                                                  value,
-                                                                  r_inputs1->
-                                                                  value,
-                                                                  cpid);
-                                                         char *flog =
-                                                         (char *)
-                                                         malloc ((strlen
-                                                                  (r_inputs->
-                                                                   value) +
-                                                                  strlen
-                                                                  (r_inputs1->
-                                                                   value) +
-                                                                  1024) *
-                                                                 sizeof
-                                                                 (char));
-                                                         sprintf (flog,
-                                                                  "%s/%s_%d_error.log",
-                                                                  r_inputs->
-                                                                  value,
-                                                                  r_inputs1->
-                                                                  value,
-                                                                  cpid);
-#ifdef DEBUG
-                                                         fprintf (stderr,
-                                                                  "RUN IN BACKGROUND MODE \n");
-                                                         fprintf (stderr,
-                                                                  "son pid continue (origin %d) %d ...\n",
-                                                                  cpid,
-                                                                  getpid ());
-                                                         fprintf (stderr,
-                                                                  "\nFILE TO STORE DATA %s\n",
-                                                                  r_inputs->
-                                                                  value);
-#endif
-                                                         freopen (flog, "w+",
-                                                                  stderr);
-                                                         f0 =
-                                                         freopen (fbkp, "w+",
-                                                                  stdout);
+          r_inputs = getMapFromMaps (m, "main", "tmpPath");
+          map *r_inputs1 = getMap (s1->content,
+                                   "ServiceProvider");
+          fbkp = (char *)
+            malloc ((strlen
+                     (r_inputs->value) +
+                     strlen (r_inputs1->value) + 1024) * sizeof (char));
+          sprintf (fbkp, "%s/%s_%d.xml", r_inputs->value,
+                   r_inputs1->value, cpid);
+          char *flog =
+            (char *)
+            malloc ((strlen (r_inputs->value) +
+                     strlen (r_inputs1->value) + 1024) * sizeof (char));
+          sprintf (flog, "%s/%s_%d_error.log", r_inputs->value,
+                   r_inputs1->value, cpid);
+#ifdef DEBUG
+          fprintf (stderr, "RUN IN BACKGROUND MODE \n");
+          fprintf (stderr,
+                   "son pid continue (origin %d) %d ...\n", cpid, getpid ());
+          fprintf (stderr, "\nFILE TO STORE DATA %s\n", r_inputs->value);
+#endif
+          freopen (flog, "w+", stderr);
+          f0 = freopen (fbkp, "w+", stdout);
 #ifndef WIN32
-                                                         fclose (stdin);
-#endif
-                                                         free (flog);
+          fclose (stdin);
+#endif
+          free (flog);
       /**
        * set status to SERVICE_STARTED and flush stdout to ensure full 
@@ -3394,70 +3257,50 @@
        * this way the data will be updated at the end of the process run.
        */
-                                                         printProcessResponse
-                                                         (m, request_inputs,
-                                                          cpid, s1,
-                                                          r_inputs1->value,
-                                                          SERVICE_STARTED,
-                                                          request_input_real_format,
-                                                          request_output_real_format);
+          printProcessResponse
+            (m, request_inputs,
+             cpid, s1,
+             r_inputs1->value,
+             SERVICE_STARTED,
+             request_input_real_format, request_output_real_format);
 #ifndef WIN32
-                                                         fflush (stdout);
-                                                         rewind (stdout);
+          fflush (stdout);
+          rewind (stdout);
 #else
 #endif
-                                                         fbkp1 =
-                                                         (char *)
-                                                         malloc ((strlen
-                                                                  (r_inputs->
-                                                                   value) +
-                                                                  strlen
-                                                                  (r_inputs1->
-                                                                   value) +
-                                                                  1024) *
-                                                                 sizeof
-                                                                 (char));
-                                                         sprintf (fbkp1,
-                                                                  "%s/%s_final_%d.xml",
-                                                                  r_inputs->
-                                                                  value,
-                                                                  r_inputs1->
-                                                                  value,
-                                                                  cpid);
-                                                         f1 =
-                                                         freopen (fbkp1, "w+",
-                                                                  stdout);
-                                                         loadServiceAndRun
-                                                         (&m, s1,
-                                                          request_inputs,
-                                                          &request_input_real_format,
-                                                          &request_output_real_format,
-                                                          &eres);}
-                                                         else
-                                                         {
+          fbkp1 = (char *)
+            malloc ((strlen
+                     (r_inputs->value) +
+                     strlen (r_inputs1->value) + 1024) * sizeof (char));
+          sprintf (fbkp1, "%s/%s_final_%d.xml", r_inputs->value,
+                   r_inputs1->value, cpid);
+          f1 = freopen (fbkp1, "w+", stdout);
+          loadServiceAndRun
+            (&m, s1,
+             request_inputs,
+             &request_input_real_format, &request_output_real_format, &eres);
+        }
+      else
+        {
       /**
        * error server don't accept the process need to output a valid 
        * error response here !!!
        */
-                                                         eres = -1;
-                                                         errorException (m,
-                                                                         _
-                                                                         ("Unable to run the child process properly"),
-                                                                         "InternalError",
-                                                                         NULL);}
-                                                         }
-
-#ifdef DEBUG
-                                                         dumpMaps
-                                                         (request_output_real_format);
-#endif
-                                                         if (eres != -1)
-                                                         outputResponse (s1,
-                                                                         request_input_real_format,
-                                                                         request_output_real_format,
-                                                                         request_inputs,
-                                                                         cpid,
-                                                                         m,
-                                                                         eres);
-                                                         fflush (stdout);
+          eres = -1;
+          errorException (m,
+                          _
+                          ("Unable to run the child process properly"),
+                          "InternalError", NULL);
+        }
+    }
+
+#ifdef DEBUG
+  dumpMaps (request_output_real_format);
+#endif
+  if (eres != -1)
+    outputResponse (s1,
+                    request_input_real_format,
+                    request_output_real_format,
+                    request_inputs, cpid, m, eres);
+  fflush (stdout);
   /**
    * Ensure that if error occurs when freeing memory, no signal will return
@@ -3466,82 +3309,52 @@
    */
 #ifndef USE_GDB
-                                                         (void)
-                                                         signal (SIGSEGV,
-                                                                 donothing);
-                                                         (void)
-                                                         signal (SIGTERM,
-                                                                 donothing);
-                                                         (void)
-                                                         signal (SIGINT,
-                                                                 donothing);
-                                                         (void)
-                                                         signal (SIGILL,
-                                                                 donothing);
-                                                         (void)
-                                                         signal (SIGFPE,
-                                                                 donothing);
-                                                         (void)
-                                                         signal (SIGABRT,
-                                                                 donothing);
-#endif
-                                                         if (((int) getpid ())
-                                                             != cpid
-                                                             || cgiSid !=
-                                                             NULL)
-                                                         {
-                                                         fclose (stdout);
-                                                         fclose (stderr);
-                                                         unhandleStatus (m);
+  (void) signal (SIGSEGV, donothing);
+  (void) signal (SIGTERM, donothing);
+  (void) signal (SIGINT, donothing);
+  (void) signal (SIGILL, donothing);
+  (void) signal (SIGFPE, donothing);
+  (void) signal (SIGABRT, donothing);
+#endif
+  if (((int) getpid ()) != cpid || cgiSid != NULL)
+    {
+      fclose (stdout);
+      fclose (stderr);
+      unhandleStatus (m);
     /**
      * Dump back the final file fbkp1 to fbkp
      */
-                                                         fclose (f0);
-                                                         fclose (f1);
-                                                         FILE * f2 =
-                                                         fopen (fbkp1, "rb");
-                                                         FILE * f3 =
-                                                         fopen (fbkp, "wb+");
-                                                         free (fbkp);
-                                                         fseek (f2, 0,
-                                                                SEEK_END);
-                                                         long flen =
-                                                         ftell (f2);
-                                                         fseek (f2, 0,
-                                                                SEEK_SET);
-                                                         char *tmps1 =
-                                                         (char
-                                                          *)malloc ((flen +
-                                                                     1) *
-                                                                    sizeof
-                                                                    (char));
-                                                         fread (tmps1, flen,
-                                                                1, f2);
-                                                         fwrite (tmps1, 1,
-                                                                 flen, f3);
-                                                         fclose (f2);
-                                                         fclose (f3);
-                                                         unlink (fbkp1);
-                                                         free (fbkp1);
-                                                         free (tmps1);}
-
-                                                         freeService (&s1);
-                                                         free (s1);
-                                                         freeMaps (&m);
-                                                         free (m);
-                                                         freeMaps
-                                                         (&request_input_real_format);
-                                                         free
-                                                         (request_input_real_format);
-                                                         freeMaps
-                                                         (&request_output_real_format);
-                                                         free
-                                                         (request_output_real_format);
-                                                         free (REQUEST);
-                                                         free (SERVICE_URL);
-#ifdef DEBUG
-                                                         fprintf (stderr,
-                                                                  "Processed response \n");
-                                                         fflush (stdout);
-                                                         fflush (stderr);
-#endif
-                                                         return 0;}
+      fclose (f0);
+      fclose (f1);
+      FILE *f2 = fopen (fbkp1, "rb");
+      FILE *f3 = fopen (fbkp, "wb+");
+      free (fbkp);
+      fseek (f2, 0, SEEK_END);
+      long flen = ftell (f2);
+      fseek (f2, 0, SEEK_SET);
+      char *tmps1 = (char *) malloc ((flen + 1) * sizeof (char));
+      fread (tmps1, flen, 1, f2);
+      fwrite (tmps1, 1, flen, f3);
+      fclose (f2);
+      fclose (f3);
+      unlink (fbkp1);
+      free (fbkp1);
+      free (tmps1);
+    }
+
+  freeService (&s1);
+  free (s1);
+  freeMaps (&m);
+  free (m);
+  freeMaps (&request_input_real_format);
+  free (request_input_real_format);
+  freeMaps (&request_output_real_format);
+  free (request_output_real_format);
+  free (REQUEST);
+  free (SERVICE_URL);
+#ifdef DEBUG
+  fprintf (stderr, "Processed response \n");
+  fflush (stdout);
+  fflush (stderr);
+#endif
+  return 0;
+}
