Ignore:
Timestamp:
Sep 29, 2012, 3:59:06 PM (12 years ago)
Author:
djay
Message:

Update to make ZOO-Kernel able to compile and run from Windows Platforms. A special thanks to Espen Messel, Knut Landmark and Benrd Härtwig for providing many patches that I can successfully apply on the SVN source tree and to Farkas for continuing requesting for ZOO-Kernel to run on Windows platforms privately and through the ZOO-Discuss mailing list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r362 r364  
    7878#include <windows.h>
    7979#include <direct.h>
     80#include <sys/types.h>
     81#include <sys/stat.h>
     82#include <unistd.h>
     83#define pid_t int;
    8084#endif
    8185#include <fcntl.h>
    8286#include <time.h>
    8387#include <stdarg.h>
     88
     89#ifdef WIN32
     90extern "C" {
     91__declspec(dllexport) char *strcasestr(char const *a, char const *b) {
     92    char *x=_strdup(a);
     93    char *y=_strdup(b);
     94
     95    x=_strlwr(x);
     96    y=_strlwr(y);
     97    char *pos = strstr(x, y);
     98    char *ret = pos == NULL ? NULL : (char *)(a + (pos-x));
     99    free(x);
     100    free(y);
     101    return ret;
     102}
     103}
     104#endif
    84105
    85106#define _(String) dgettext ("zoo-kernel",String)
     
    218239  fflush(stderr);
    219240#endif
    220   if(strncasecmp(r_inputs->value,"C",1)==0){
     241  if(strlen(r_inputs->value)==1 && strncasecmp(r_inputs->value,"C",1)==0){
    221242    r_inputs=getMap(request_inputs,"metapath");
    222243    if(r_inputs!=NULL)
     
    402423              }
    403424  *myMap=m;
    404 #ifndef WIN32
    405425  *ioutputs=request_output_real_format;
    406 #endif
    407426}
    408427
     
    521540  bindtextdomain ("zoo-kernel","/usr/share/locale/");
    522541  bindtextdomain ("zoo-services","/usr/share/locale/");
    523  
     542
     543  /**
     544   * Manage our own error log file (usefull to separate standard apache debug
     545   * messages from the ZOO-Kernel ones but also for IIS users to avoid wrong
     546   * headers messages returned by the CGI due to wrong redirection of stderr)
     547   */
     548  FILE * fstde=NULL;
     549  map* fstdem=getMapFromMaps(m,"main","logPath");
     550  if(fstdem!=NULL)
     551        fstde = freopen(fstdem->value, "a+", stderr) ;
     552
    524553  if((r_inputs=getMap(request_inputs,"language"))!=NULL){
    525554    char *tmp=strdup(r_inputs->value);
     
    18291858    return 1;
    18301859  }
    1831 
    18321860  maps* tmpReqI=request_input_real_format;
    18331861  while(tmpReqI!=NULL){
     
    18421870        char fileNameOnServer[64];
    18431871        char contentType[1024];
    1844         char buffer[BufferLen];
     1872        char buffer[1024];
    18451873        char *tmpStr=NULL;
    18461874        int size;
     
    18661894          fprintf(stderr,"fileNameOnServer: %s\n",fileNameOnServer);
    18671895          mode=S_IRWXU|S_IRGRP|S_IROTH;
    1868           targetFile = open (storageNameOnServer,O_RDWR|O_CREAT|O_TRUNC,mode);
     1896          targetFile = open (storageNameOnServer,O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP|S_IROTH);
    18691897          if(targetFile<0){
    18701898            fprintf(stderr,"could not create the new file,%s\n",fileNameOnServer);         
     
    19121940#ifdef DEBUG
    19131941      fflush(stderr);
    1914       fprintf(stderr,"setting variable... %s\n",
     1942      fprintf(stderr,"setting variable... %s\n",(
    19151943#endif
    19161944              SetEnvironmentVariable(mapcs->name,mapcs->value)
    19171945#ifdef DEBUG
    1918               ? "OK" : "FAILED");
     1946              ==0)? "OK" : "FAILED");
    19191947#else
    19201948      ;
    19211949#endif
     1950          char* toto=(char*)malloc((strlen(mapcs->name)+strlen(mapcs->value)+2)*sizeof(char));
     1951      sprintf(toto,"%s=%s",mapcs->name,mapcs->value);
     1952          putenv(toto);
    19221953#ifdef DEBUG
    19231954      fflush(stderr);
     
    20362067    addToMap(request_inputs,"status","true");
    20372068    status=getMap(request_inputs,"status");
    2038     fprintf(stderr,"cgiSID : %s",cgiSid);
     2069    //fprintf(stderr,"cgiSID : %s",cgiSid);
    20392070  }
    20402071#endif
    20412072  if(status!=NULL)
    20422073    if(strcasecmp(status->value,"false")==0)
    2043       status=NULL;
     2074      status=NULLMAP;
    20442075  if(status==NULLMAP){
    20452076    loadServiceAndRun(&m,s1,request_inputs,&request_input_real_format,&request_output_real_format,&eres);
    20462077  }
    20472078  else{
    2048     pid_t   pid;
     2079    int   pid;
    20492080#ifdef DEBUG
    20502081    fprintf(stderr,"\nPID : %d\n",cpid);
     
    21712202  return 0;
    21722203}
     2204
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png