summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.(none)>2004-08-24 19:07:08 +0000
committerunknown <tomas@poseidon.(none)>2004-08-24 19:07:08 +0000
commita8f24dc7d97b61fadd105e2c1f48f1132f72ae90 (patch)
tree90eb5474b5d541b644aff5a8d5462743966957bc /ndb
parent6b20f46abc65f8b3dd851df71d04b89cb0d3f208 (diff)
parent0639dbbfae84bf1cba37d7343cf9788dc965ad4e (diff)
downloadmariadb-git-a8f24dc7d97b61fadd105e2c1f48f1132f72ae90.tar.gz
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1
into poseidon.(none):/home/tomas/mysql-4.1-clean
Diffstat (limited to 'ndb')
-rw-r--r--ndb/src/common/mgmcommon/ConfigInfo.cpp15
-rw-r--r--ndb/src/common/mgmcommon/ConfigInfo.hpp7
-rw-r--r--ndb/src/common/mgmcommon/InitConfigFileParser.cpp31
3 files changed, 50 insertions, 3 deletions
diff --git a/ndb/src/common/mgmcommon/ConfigInfo.cpp b/ndb/src/common/mgmcommon/ConfigInfo.cpp
index 997c26a95d6..efa7703b523 100644
--- a/ndb/src/common/mgmcommon/ConfigInfo.cpp
+++ b/ndb/src/common/mgmcommon/ConfigInfo.cpp
@@ -25,6 +25,13 @@
/****************************************************************************
* Section names
****************************************************************************/
+
+const ConfigInfo::AliasPair
+ConfigInfo::m_sectionNameAliases[]={
+ {"API", "MYSQLD"},
+ {0, 0}
+};
+
const char*
ConfigInfo::m_sectionNames[]={
"SYSTEM",
@@ -2063,6 +2070,14 @@ ConfigInfo::isSection(const char * section) const {
return false;
}
+const char*
+ConfigInfo::getAlias(const char * section) const {
+ for (int i = 0; m_sectionNameAliases[i].name != 0; i++)
+ if(!strcmp(section, m_sectionNameAliases[i].alias))
+ return m_sectionNameAliases[i].name;
+ return 0;
+}
+
bool
ConfigInfo::verify(const Properties * section, const char* fname,
Uint64 value) const {
diff --git a/ndb/src/common/mgmcommon/ConfigInfo.hpp b/ndb/src/common/mgmcommon/ConfigInfo.hpp
index 79c17b436fe..9a954fe78d5 100644
--- a/ndb/src/common/mgmcommon/ConfigInfo.hpp
+++ b/ndb/src/common/mgmcommon/ConfigInfo.hpp
@@ -61,6 +61,11 @@ public:
Uint64 _max;
};
+ struct AliasPair{
+ const char * name;
+ const char * alias;
+ };
+
/**
* Entry for one section rule
*/
@@ -100,6 +105,7 @@ public:
* @note Result is not defined if section/name are wrong!
*/
bool verify(const Properties* secti, const char* fname, Uint64 value) const;
+ const char* getAlias(const char*) const;
bool isSection(const char*) const;
const char* getDescription(const Properties * sec, const char* fname) const;
@@ -123,6 +129,7 @@ private:
static const ParamInfo m_ParamInfo[];
static const int m_NoOfParams;
+ static const AliasPair m_sectionNameAliases[];
static const char* m_sectionNames[];
static const int m_noOfSectionNames;
diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
index d52bc54db52..68e287a3ffb 100644
--- a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
+++ b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
@@ -222,6 +222,8 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) {
char tmpLine[MAX_LINE_LENGTH];
char fname[MAX_LINE_LENGTH], rest[MAX_LINE_LENGTH];
char* t;
+ const char separator_list[]= {':', '='};
+ char separator= 0;
if (ctx.m_currentSection == NULL){
ctx.reportError("Value specified outside section");
@@ -233,7 +235,14 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) {
// *************************************
// Check if a separator exists in line
// *************************************
- if (!strchr(tmpLine, ':')) {
+ for(int i= 0; i < sizeof(separator_list); i++) {
+ if(strchr(tmpLine, separator_list[i])) {
+ separator= separator_list[i];
+ break;
+ }
+ }
+
+ if (separator == 0) {
ctx.reportError("Parse error");
return false;
}
@@ -247,7 +256,7 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) {
// Count number of tokens before separator
// *****************************************
if (sscanf(t, "%120s%120s", fname, rest) != 1) {
- ctx.reportError("Multiple names before \':\'");
+ ctx.reportError("Multiple names before \'%c\'", separator);
return false;
}
if (!ctx.m_currentInfo->contains(fname)) {
@@ -475,8 +484,24 @@ InitConfigFileParser::parseSectionHeader(const char* line) const {
tmp[0] = ' ';
trim(tmp);
+ // Convert section header to upper
+ for(int i= strlen(tmp)-1; i >= 0; i--)
+ tmp[i]= toupper(tmp[i]);
+
+ // Get the correct header name if an alias
+ {
+ const char *tmp_alias= m_info->getAlias(tmp);
+ if (tmp_alias) {
+ free(tmp);
+ tmp= strdup(tmp_alias);
+ }
+ }
+
// Lookup token among sections
- if(!m_info->isSection(tmp)) return NULL;
+ if(!m_info->isSection(tmp)) {
+ free(tmp);
+ return NULL;
+ }
if(m_info->getInfo(tmp)) return tmp;
free(tmp);