Corrected the parsing of data file directives

This commit is contained in:
John Wiegley 2009-11-10 02:26:34 -05:00
parent bf24b93818
commit 329a0dfcc5

View file

@ -703,60 +703,66 @@ void instance_t::define_directive(char * line)
bool instance_t::general_directive(char * line) bool instance_t::general_directive(char * line)
{ {
char * p = line; char buf[8192];
std::strcpy(buf, line);
char * p = buf;
char * arg = next_element(buf);
if (*p == '@' || *p == '!') if (*p == '@' || *p == '!')
p++; p++;
switch (*p) { switch (*p) {
case 'a': case 'a':
if (std::strcmp(p, "account") == 0) { if (std::strcmp(p, "account") == 0) {
master_account_directive(next_element(line)); master_account_directive(arg);
return true; return true;
} }
else if (std::strcmp(p, "alias") == 0) { else if (std::strcmp(p, "alias") == 0) {
alias_directive(next_element(line)); alias_directive(arg);
return true; return true;
} }
break; break;
case 'b': case 'b':
if (std::strcmp(p, "bucket") == 0) { if (std::strcmp(p, "bucket") == 0) {
default_account_directive(next_element(line)); default_account_directive(arg);
return true; return true;
} }
break; break;
case 'd': case 'd':
if (std::strcmp(p, "def") == 0 || std::strcmp(p, "define") == 0) { if (std::strcmp(p, "def") == 0 || std::strcmp(p, "define") == 0) {
define_directive(next_element(line)); define_directive(arg);
return true; return true;
} }
break; break;
case 'e': case 'e':
if (std::strcmp(p, "end") == 0) { if (std::strcmp(p, "end") == 0) {
end_directive(next_element(line)); end_directive(arg);
return true; return true;
} }
break; break;
case 'i': case 'i':
if (std::strcmp(p, "include") == 0) { if (std::strcmp(p, "include") == 0) {
include_directive(next_element(line)); include_directive(arg);
return true; return true;
} }
break; break;
case 'p': case 'p':
if (std::strcmp(p, "pop") == 0) { if (std::strcmp(p, "pop") == 0) {
pop_directive(next_element(line)); pop_directive(arg);
return true; return true;
} }
break; break;
case 't': case 't':
if (std::strcmp(p, "tag") == 0) { if (std::strcmp(p, "tag") == 0) {
tag_directive(next_element(line)); tag_directive(arg);
return true; return true;
} }
break; break;