Commit 0483eb81 authored by tomas@poseidon.(none)'s avatar tomas@poseidon.(none)

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.(none):/home/tomas/mysql-4.1-clean
parents 06affe9b aae0b7ed
...@@ -24,13 +24,13 @@ ExecuteOnComputer: 2 ...@@ -24,13 +24,13 @@ ExecuteOnComputer: 2
[MGM] [MGM]
PortNumber: CHOOSE_PORT_MGM PortNumber: CHOOSE_PORT_MGM
[API] [MYSQLD]
[API] [MYSQLD]
[API] [MYSQLD]
[API] [MYSQLD]
[TCP DEFAULT] [TCP DEFAULT]
PortNumber: CHOOSE_PORT_TRANSPORTER PortNumber: CHOOSE_PORT_TRANSPORTER
...@@ -25,6 +25,13 @@ ...@@ -25,6 +25,13 @@
/**************************************************************************** /****************************************************************************
* Section names * Section names
****************************************************************************/ ****************************************************************************/
const ConfigInfo::AliasPair
ConfigInfo::m_sectionNameAliases[]={
{"API", "MYSQLD"},
{0, 0}
};
const char* const char*
ConfigInfo::m_sectionNames[]={ ConfigInfo::m_sectionNames[]={
"SYSTEM", "SYSTEM",
...@@ -2063,6 +2070,14 @@ ConfigInfo::isSection(const char * section) const { ...@@ -2063,6 +2070,14 @@ ConfigInfo::isSection(const char * section) const {
return false; 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 bool
ConfigInfo::verify(const Properties * section, const char* fname, ConfigInfo::verify(const Properties * section, const char* fname,
Uint64 value) const { Uint64 value) const {
......
...@@ -61,6 +61,11 @@ public: ...@@ -61,6 +61,11 @@ public:
Uint64 _max; Uint64 _max;
}; };
struct AliasPair{
const char * name;
const char * alias;
};
/** /**
* Entry for one section rule * Entry for one section rule
*/ */
...@@ -100,6 +105,7 @@ public: ...@@ -100,6 +105,7 @@ public:
* @note Result is not defined if section/name are wrong! * @note Result is not defined if section/name are wrong!
*/ */
bool verify(const Properties* secti, const char* fname, Uint64 value) const; bool verify(const Properties* secti, const char* fname, Uint64 value) const;
const char* getAlias(const char*) const;
bool isSection(const char*) const; bool isSection(const char*) const;
const char* getDescription(const Properties * sec, const char* fname) const; const char* getDescription(const Properties * sec, const char* fname) const;
...@@ -123,6 +129,7 @@ private: ...@@ -123,6 +129,7 @@ private:
static const ParamInfo m_ParamInfo[]; static const ParamInfo m_ParamInfo[];
static const int m_NoOfParams; static const int m_NoOfParams;
static const AliasPair m_sectionNameAliases[];
static const char* m_sectionNames[]; static const char* m_sectionNames[];
static const int m_noOfSectionNames; static const int m_noOfSectionNames;
......
...@@ -222,6 +222,8 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { ...@@ -222,6 +222,8 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) {
char tmpLine[MAX_LINE_LENGTH]; char tmpLine[MAX_LINE_LENGTH];
char fname[MAX_LINE_LENGTH], rest[MAX_LINE_LENGTH]; char fname[MAX_LINE_LENGTH], rest[MAX_LINE_LENGTH];
char* t; char* t;
const char separator_list[]= {':', '='};
char separator= 0;
if (ctx.m_currentSection == NULL){ if (ctx.m_currentSection == NULL){
ctx.reportError("Value specified outside section"); ctx.reportError("Value specified outside section");
...@@ -233,7 +235,14 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { ...@@ -233,7 +235,14 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) {
// ************************************* // *************************************
// Check if a separator exists in 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"); ctx.reportError("Parse error");
return false; return false;
} }
...@@ -247,7 +256,7 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { ...@@ -247,7 +256,7 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) {
// Count number of tokens before separator // Count number of tokens before separator
// ***************************************** // *****************************************
if (sscanf(t, "%120s%120s", fname, rest) != 1) { if (sscanf(t, "%120s%120s", fname, rest) != 1) {
ctx.reportError("Multiple names before \':\'"); ctx.reportError("Multiple names before \'%c\'", separator);
return false; return false;
} }
if (!ctx.m_currentInfo->contains(fname)) { if (!ctx.m_currentInfo->contains(fname)) {
...@@ -475,8 +484,24 @@ InitConfigFileParser::parseSectionHeader(const char* line) const { ...@@ -475,8 +484,24 @@ InitConfigFileParser::parseSectionHeader(const char* line) const {
tmp[0] = ' '; tmp[0] = ' ';
trim(tmp); 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 // 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; if(m_info->getInfo(tmp)) return tmp;
free(tmp); free(tmp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment