1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -37,118 +37,131 @@ namespace
void usage(const string& pname)
{
cout << "usage: " << pname << " [-vh] [-c config_file] section param" << endl <<
" Displays configuration variable param from section section." << endl <<
" -c config_file use config file config_file" << endl <<
" -a display all configuration values" << endl <<
" -i display all configuration values in .ini-file format (implies -a)" << endl <<
" -v display verbose information" << endl <<
" -h display this help text" << endl;
cout << "usage: " << pname << " [-vh] [-c config_file] section param" << endl <<
" Displays configuration variable param from section section." << endl <<
" -c config_file use config file config_file" << endl <<
" -a display all configuration values" << endl <<
" -i display all configuration values in .ini-file format (implies -a)" << endl <<
" -v display verbose information" << endl <<
" -h display this help text" << endl;
}
}
int main(int argc, char** argv)
{
int c;
string pname(argv[0]);
bool vflg = false;
string configFile;
bool aflg = false;
bool iflg = false;
int c;
string pname(argv[0]);
bool vflg = false;
string configFile;
bool aflg = false;
bool iflg = false;
opterr = 0;
opterr = 0;
while ((c = getopt(argc, argv, "c:vaih")) != EOF)
switch (c)
{
case 'v':
vflg = true;
break;
case 'c':
configFile = optarg;
break;
case 'a':
aflg = true;
break;
case 'i':
iflg = aflg = true;
break;
case 'h':
case '?':
default:
usage(pname);
return (c == 'h' ? 0 : 1);
break;
}
while ((c = getopt(argc, argv, "c:vaih")) != EOF)
switch (c)
{
case 'v':
vflg = true;
break;
if (!aflg && ( (argc - optind) < 2 ))
{
usage(pname);
return 1;
}
case 'c':
configFile = optarg;
break;
case 'a':
aflg = true;
break;
case 'i':
iflg = aflg = true;
break;
case 'h':
case '?':
default:
usage(pname);
return (c == 'h' ? 0 : 1);
break;
}
if (!aflg && ( (argc - optind) < 2 ))
{
usage(pname);
return 1;
}
try
{
openlog("getConfig", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER);
Config* cf;
if (configFile.length() > 0)
cf = Config::makeConfig(configFile);
else
cf = Config::makeConfig();
Config* cf;
if (vflg)
{
cout << "Using config file: " << cf->configFile() << endl;
}
if (configFile.length() > 0)
cf = Config::makeConfig(configFile);
else
cf = Config::makeConfig();
if (aflg)
{
vector<string> secs;
vector<string> parms;
secs = cf->enumConfig();
vector<string>::iterator siter;
vector<string>::iterator send;
vector<string>::iterator piter;
vector<string>::iterator pend;
siter = secs.begin();
send = secs.end();
while (siter != send)
{
if (iflg)
cout << '[' << *siter << ']' << endl;
parms = cf->enumSection(*siter);
piter = parms.begin();
pend = parms.end();
while (piter != pend)
{
if (iflg)
cout << *piter << " = " << cf->getConfig(*siter, *piter) << endl;
else
cout << *siter << '.' << *piter << " = " <<
cf->getConfig(*siter, *piter) << endl;
++piter;
}
++siter;
if (iflg)
cout << endl;
}
return 0;
}
if (vflg)
{
cout << "Using config file: " << cf->configFile() << endl;
}
cout << cf->getConfig(argv[optind + 0], argv[optind + 1]) << endl;
if (aflg)
{
vector<string> secs;
vector<string> parms;
secs = cf->enumConfig();
vector<string>::iterator siter;
vector<string>::iterator send;
vector<string>::iterator piter;
vector<string>::iterator pend;
siter = secs.begin();
send = secs.end();
while (siter != send)
{
if (iflg)
cout << '[' << *siter << ']' << endl;
parms = cf->enumSection(*siter);
piter = parms.begin();
pend = parms.end();
while (piter != pend)
{
if (iflg)
cout << *piter << " = " << cf->getConfig(*siter, *piter) << endl;
else
cout << *siter << '.' << *piter << " = " <<
cf->getConfig(*siter, *piter) << endl;
++piter;
}
++siter;
if (iflg)
cout << endl;
}
return 0;
}
cout << cf->getConfig(argv[optind + 0], argv[optind + 1]) << endl;
closelog();
}
catch(exception &e)
catch (exception& e)
{
syslog(LOG_ERR, "Exception in getConfig for %s %s : %s", argv[optind + 0], argv[optind + 1], e.what());
closelog();
closelog();
}
catch(...)
catch (...)
{
syslog(LOG_ERR, "Exception in getConfig for %s %s : Unknown exception", argv[optind + 0], argv[optind + 1]);
closelog();
}
return 0;
}
return 0;
}