You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by su...@apache.org on 2003/10/07 10:21:02 UTC
cvs commit: ws-axis/c/src/common AxisConfig.cpp
susantha 2003/10/07 01:21:02
Modified: c/src/common AxisConfig.cpp
Log:
Updated code so that AxisConfig::ReadConfFile works in windows as well
Revision Changes Path
1.3 +45 -42 ws-axis/c/src/common/AxisConfig.cpp
Index: AxisConfig.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisConfig.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AxisConfig.cpp 7 Oct 2003 07:58:33 -0000 1.2
+++ AxisConfig.cpp 7 Oct 2003 08:21:02 -0000 1.3
@@ -23,59 +23,62 @@
char key[CONFBUFFSIZE] = {0};
char value[CONFBUFFSIZE] = {0};
int i=0;
+ char* echocmd;
+ char* delcmd;
#ifdef WIN32
-
+ echocmd = "echo %AXIS_HOME% > ./__temp__axis";
+ delcmd = "del __temp__axis";
#else //linux
- system("echo $AXIS_HOME>./temp");
- if ((fileConfig = fopen("temp", "rb")) == NULL)
- return FAIL;
-
- else
+ echocmd = "echo $AXIS_HOME>./__temp__axis";
+ delcmd = "rm -f __temp__axis";
+ #endif
+ system(echocmd);
+ if ((fileConfig = fopen("__temp__axis", "rb")) == NULL)
+ return FAIL;
+
+ else
+ {
+ fgets(sConfPath, CONFBUFFSIZE, fileConfig);
+ while(true)
{
- fgets(sConfPath, CONFBUFFSIZE, fileConfig);
- while(true)
- {
- sNewConfPath[i] = sConfPath[i];
- i = i + 1;
- if(sConfPath[i] == '\n' || sConfPath[i] == EOF)
- break;
- }
+ sNewConfPath[i] = sConfPath[i];
+ i = i + 1;
+ if(sConfPath[i] == '\n' || sConfPath[i] == EOF)
+ break;
+ }
- strcat(sNewConfPath, "/axiscpp.conf");
- system("rm -f temp");
- if ((fileConfig2 = fopen(sNewConfPath, "rb")) == NULL)
- return FAIL;
+ strcat(sNewConfPath, "/axiscpp.conf");
+ system(delcmd);
+ if ((fileConfig2 = fopen(sNewConfPath, "rb")) == NULL)
+ return FAIL;
- while(fgets(line, CONFBUFFSIZE, fileConfig2) != NULL)
+ while(fgets(line, CONFBUFFSIZE, fileConfig2) != NULL)
+ {
+ int k=0;
+ while(line[k] != ':')
{
- int k=0;
- while(line[k] != ':')
- {
- key[k]=line[k];
- k += 1;
-
- }
+ key[k]=line[k];
k += 1;
- int j=0;
- while(line[k] != '\n')
- {
- value[j]=line[k];
- k += 1;
- j += 1;
-
- }
- if(strcmp(key, "WSDDFILEPATH") == 0)
- strcpy(m_sWsddFilePath, value);
- if(strcmp(key, "AXISLOGPATH") == 0)
- strcpy(m_sAxisLogPath, value);
+
}
- fclose(fileConfig2);
+ k += 1;
+ int j=0;
+ while(line[k] != '\n')
+ {
+ value[j]=line[k];
+ k += 1;
+ j += 1;
+ }
+ if(strcmp(key, "WSDDFILEPATH") == 0)
+ strcpy(m_sWsddFilePath, value);
+ if(strcmp(key, "AXISLOGPATH") == 0)
+ strcpy(m_sAxisLogPath, value);
}
- fclose(fileConfig);
-
+ fclose(fileConfig2);
- #endif
+ }
+ fclose(fileConfig);
return SUCCESS;
}