2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
19 * Author : Maxim Mamontov <faust@stargazer.dp.ua>
30 #include "stg/servconf.h"
31 #include "stg/user_conf.h"
32 #include "stg/user_stat.h"
33 #include "stg/common.h"
54 typedef typename T::value_type type;
58 struct ARRAY_TYPE<T[]>
63 template <typename T, size_t N>
64 struct ARRAY_TYPE<T[N]>
70 struct nullary_function
72 typedef T result_type;
76 class binder0 : public nullary_function<typename F::result_type>
79 binder0(const F & func, const typename F::argument_type & arg)
80 : m_func(func), m_arg(arg) {}
81 typename F::result_type operator()() const { return m_func(m_arg); }
84 typename F::argument_type m_arg;
89 binder0<F> bind0(const F & func, const typename F::argument_type & arg)
91 return binder0<F>(func, arg);
94 template <typename C, typename A, typename R>
95 class METHOD1_ADAPTER : public std::unary_function<A, R>
98 METHOD1_ADAPTER(R (C::* func)(A), C & obj) : m_func(func), m_obj(obj) {}
99 R operator()(A arg) { return (m_obj.*m_func)(arg); }
105 template <typename C, typename A, typename R>
106 class CONST_METHOD1_ADAPTER : public std::unary_function<A, R>
109 CONST_METHOD1_ADAPTER(R (C::* func)(A) const, C & obj) : m_func(func), m_obj(obj) {}
110 R operator()(A arg) const { return (m_obj.*m_func)(arg); }
112 R (C::* m_func)(A) const;
116 template <typename C, typename A, typename R>
117 METHOD1_ADAPTER<C, A, R> Method1Adapt(R (C::* func)(A), C & obj)
119 return METHOD1_ADAPTER<C, A, R>(func, obj);
122 template <typename C, typename A, typename R>
123 CONST_METHOD1_ADAPTER<C, A, R> Method1Adapt(R (C::* func)(A) const, C & obj)
125 return CONST_METHOD1_ADAPTER<C, A, R>(func, obj);
128 template <typename T>
129 bool SetArrayItem(T & array, const char * index, const typename ARRAY_TYPE<T>::type & value)
132 if (str2x(index, pos))
138 void RawXMLCallback(bool result, const std::string & reason, const std::string & response, void * /*data*/)
142 std::cerr << "Failed to get raw XML response. Reason: '" << reason << "'." << std::endl;
145 SGCONF::PrintXML(response);
150 void UsageImpl(bool full);
151 void UsageConnection();
152 void UsageAdmins(bool full);
153 void UsageTariffs(bool full);
154 void UsageUsers(bool full);
155 void UsageServices(bool full);
156 void UsageCorporations(bool full);
160 void ReadUserConfigFile(SGCONF::OPTION_BLOCK & block)
162 std::vector<std::string> paths;
163 const char * configHome = getenv("XDG_CONFIG_HOME");
164 if (configHome == NULL)
166 const char * home = getenv("HOME");
169 paths.push_back(std::string(home) + "/.config/sgconf/sgconf.conf");
170 paths.push_back(std::string(home) + "/.sgconf/sgconf.conf");
173 paths.push_back(std::string(configHome) + "/sgconf/sgconf.conf");
174 for (std::vector<std::string>::const_iterator it = paths.begin(); it != paths.end(); ++it)
175 if (access(it->c_str(), R_OK) == 0)
177 block.ParseFile(*it);
182 } // namespace anonymous
187 class CONFIG_ACTION : public ACTION
190 CONFIG_ACTION(SGCONF::CONFIG & config,
191 const std::string & paramDescription)
193 m_description(paramDescription)
196 virtual ACTION * Clone() const { return new CONFIG_ACTION(*this); }
198 virtual std::string ParamDescription() const { return m_description; }
199 virtual std::string DefaultDescription() const { return ""; }
200 virtual OPTION_BLOCK & Suboptions() { return m_suboptions; }
201 virtual PARSER_STATE Parse(int argc, char ** argv);
204 SGCONF::CONFIG & m_config;
205 std::string m_description;
206 OPTION_BLOCK m_suboptions;
208 void ParseCredentials(const std::string & credentials);
209 void ParseHostAndPort(const std::string & hostAndPort);
212 typedef bool (* API_FUNCTION) (const SGCONF::CONFIG &,
214 const std::map<std::string, std::string> &);
219 COMMAND(API_FUNCTION funPtr,
220 const std::string & arg,
221 const std::map<std::string, std::string> & options)
226 bool Execute(const SGCONF::CONFIG & config) const
228 return m_funPtr(config, m_arg, m_options);
232 API_FUNCTION m_funPtr;
234 std::map<std::string, std::string> m_options;
240 void Add(API_FUNCTION funPtr,
241 const std::string & arg,
242 const std::map<std::string, std::string> & options) { m_commands.push_back(COMMAND(funPtr, arg, options)); }
243 bool Execute(const SGCONF::CONFIG & config) const
245 std::list<COMMAND>::const_iterator it(m_commands.begin());
247 while (it != m_commands.end() && res)
249 res = res && it->Execute(config);
255 std::list<COMMAND> m_commands;
258 class API_ACTION : public ACTION
261 API_ACTION(COMMANDS & commands,
262 const std::string & paramDescription,
264 const OPTION_BLOCK& suboptions,
266 : m_commands(commands),
267 m_description(paramDescription),
268 m_argument(needArgument ? "1" : ""), // Hack
269 m_suboptions(suboptions),
272 API_ACTION(COMMANDS & commands,
273 const std::string & paramDescription,
276 : m_commands(commands),
277 m_description(paramDescription),
278 m_argument(needArgument ? "1" : ""), // Hack
282 virtual ACTION * Clone() const { return new API_ACTION(*this); }
284 virtual std::string ParamDescription() const { return m_description; }
285 virtual std::string DefaultDescription() const { return ""; }
286 virtual OPTION_BLOCK & Suboptions() { return m_suboptions; }
287 virtual PARSER_STATE Parse(int argc, char ** argv)
289 PARSER_STATE state(false, argc, argv);
290 if (!m_argument.empty())
295 throw ERROR("Missing argument.");
300 m_suboptions.Parse(state.argc, state.argv);
301 m_commands.Add(m_funPtr, m_argument, m_params);
306 COMMANDS & m_commands;
307 std::string m_description;
308 std::string m_argument;
309 OPTION_BLOCK m_suboptions;
310 std::map<std::string, std::string> m_params;
311 API_FUNCTION m_funPtr;
314 PARSER_STATE CONFIG_ACTION::Parse(int argc, char ** argv)
319 throw ERROR("Missing argument.");
320 char * pos = strchr(*argv, '@');
323 ParseCredentials(std::string(*argv, pos));
324 ParseHostAndPort(std::string(pos + 1));
328 ParseHostAndPort(std::string(*argv));
330 return PARSER_STATE(false, --argc, ++argv);
333 void CONFIG_ACTION::ParseCredentials(const std::string & credentials)
335 std::string::size_type pos = credentials.find_first_of(':');
336 if (pos != std::string::npos)
338 m_config.userName = credentials.substr(0, pos);
339 m_config.userPass = credentials.substr(pos + 1);
343 m_config.userName = credentials;
347 void CONFIG_ACTION::ParseHostAndPort(const std::string & hostAndPort)
349 std::string::size_type pos = hostAndPort.find_first_of(':');
350 if (pos != std::string::npos)
352 m_config.server = hostAndPort.substr(0, pos);
354 if (str2x(hostAndPort.substr(pos + 1), port))
355 throw ERROR("Invalid port value: '" + hostAndPort.substr(pos + 1) + "'");
356 m_config.port = port;
360 m_config.server = hostAndPort;
365 CONFIG_ACTION * MakeParamAction(SGCONF::CONFIG & config,
366 const std::string & paramDescription)
368 return new CONFIG_ACTION(config, paramDescription);
372 ACTION * MakeAPIAction(COMMANDS & commands,
373 const std::string & paramDescription,
377 return new API_ACTION(commands, paramDescription, needArgument, funPtr);
381 ACTION * MakeAPIAction(COMMANDS & commands,
384 return new API_ACTION(commands, "", false, funPtr);
387 bool RawXMLFunction(const SGCONF::CONFIG & config,
388 const std::string & arg,
389 const std::map<std::string, std::string> & /*options*/)
391 STG::SERVCONF proto(config.server.data(),
393 config.userName.data(),
394 config.userPass.data());
395 return proto.RawXML(arg, RawXMLCallback, NULL) == STG::st_ok;
398 } // namespace SGCONF
402 //-----------------------------------------------------------------------------
403 int main(int argc, char **argv)
405 SGCONF::CONFIG config;
406 SGCONF::COMMANDS commands;
408 SGCONF::OPTION_BLOCKS blocks;
409 blocks.Add("General options")
410 .Add("c", "config", SGCONF::MakeParamAction(config.configFile, std::string("~/.config/stg/sgconf.conf"), "<config file>"), "override default config file")
411 .Add("h", "help", SGCONF::MakeFunc0Action(bind0(Method1Adapt(&SGCONF::OPTION_BLOCKS::Help, blocks), 0)), "\t\tshow this help and exit")
412 .Add("help-all", SGCONF::MakeFunc0Action(UsageAll), "\t\tshow full help and exit")
413 .Add("v", "version", SGCONF::MakeFunc0Action(Version), "\t\tshow version information and exit");
414 SGCONF::OPTION_BLOCK & block = blocks.Add("Connection options")
415 .Add("s", "server", SGCONF::MakeParamAction(config.server, std::string("localhost"), "<address>"), "\t\thost to connect")
416 .Add("p", "port", SGCONF::MakeParamAction(config.port, uint16_t(5555), "<port>"), "\t\tport to connect")
417 .Add("u", "username", SGCONF::MakeParamAction(config.userName, std::string("admin"), "<username>"), "\tadministrative login")
418 .Add("w", "userpass", SGCONF::MakeParamAction(config.userPass, "<password>"), "\tpassword for the administrative login")
419 .Add("a", "address", SGCONF::MakeParamAction(config, "<connection string>"), "connection params as a single string in format: <login>:<password>@<host>:<port>");
420 blocks.Add("Raw XML")
421 .Add("r", "raw", SGCONF::MakeAPIAction(commands, "<xml>", true, SGCONF::RawXMLFunction), "\tmake raw XML request");
422 blocks.Add("Admin management options")
423 .Add("get-admins", SGCONF::MakeAPIAction(commands, SGCONF::GetAdminsFunction), "\tget admin list")
424 .Add("get-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::GetAdminFunction), "\tget admin")
425 .Add("add-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::AddAdminFunction), "\tadd admin")
426 .Add("del-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::DelAdminFunction), "\tdel admin")
427 .Add("chg-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::ChgAdminFunction), "\tchange admin");
428 blocks.Add("Tariff management options")
429 .Add("get-tariffs", SGCONF::MakeAPIAction(commands, SGCONF::GetTariffsFunction), "\tget tariff list")
430 .Add("get-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::GetTariffFunction), "\tget tariff")
431 .Add("add-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::AddTariffFunction), "\tadd tariff")
432 .Add("del-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::DelTariffFunction), "\tdel tariff")
433 .Add("chg-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::ChgTariffFunction), "\tchange tariff");
434 blocks.Add("User management options")
435 .Add("get-users", SGCONF::MakeAPIAction(commands, SGCONF::GetUsersFunction), "\tget user list")
436 .Add("get-user", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::GetUserFunction), "\tget user")
437 .Add("add-user", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::AddUserFunction), "\tadd user")
438 .Add("del-user", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::DelUserFunction), "\tdel user")
439 .Add("chg-user", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::ChgUserFunction), "\tchange user");
441 SGCONF::PARSER_STATE state(false, argc, argv);
445 state = blocks.Parse(--argc, ++argv); // Skipping self name
447 catch (const SGCONF::OPTION::ERROR& ex)
449 std::cerr << ex.what() << "\n";
458 std::cerr << "Unknown option: '" << *state.argv << "'\n";
464 SGCONF::CONFIG configOverride(config);
466 if (config.configFile.empty())
468 const char * mainConfigFile = "/etc/sgconf/sgconf.conf";
469 if (access(mainConfigFile, R_OK) == 0)
470 block.ParseFile(mainConfigFile);
471 ReadUserConfigFile(block);
475 block.ParseFile(config.configFile.data());
478 config = configOverride;
480 catch (const std::exception& ex)
482 std::cerr << ex.what() << "\n";
486 std::cerr << "Config: " << config.Serialize() << std::endl;
487 return commands.Execute(config) ? 0 : -1;
500 exit(PARAMETER_PARSING_ERR_CODE);
503 if (strcmp(argv[1], "get") == 0)
506 return mainGet(argc - 1, argv + 1);
508 else if (strcmp(argv[1], "set") == 0)
511 if (mainSet(argc - 1, argv + 1) )
518 exit(PARAMETER_PARSING_ERR_CODE);
520 return UNKNOWN_ERR_CODE;*/
522 //-----------------------------------------------------------------------------
537 void UsageImpl(bool full)
539 std::cout << "sgconf is the Stargazer management utility.\n\n"
541 << "\tsgconf [options]\n\n"
542 << "General options:\n"
543 << "\t-c, --config <config file>\t\toverride default config file (default: \"~/.config/stg/sgconf.conf\")\n"
544 << "\t-h, --help\t\t\t\tshow this help and exit\n"
545 << "\t--help-all\t\t\t\tshow full help and exit\n"
546 << "\t-v, --version\t\t\t\tshow version information and exit\n\n";
552 UsageCorporations(full);
554 //-----------------------------------------------------------------------------
555 void UsageConnection()
557 std::cout << "Connection options:\n"
558 << "\t-s, --server <address>\t\t\thost to connect (ip or domain name, default: \"localhost\")\n"
559 << "\t-p, --port <port>\t\t\tport to connect (default: \"5555\")\n"
560 << "\t-u, --username <username>\t\tadministrative login (default: \"admin\")\n"
561 << "\t-w, --userpass <password>\t\tpassword for administrative login\n"
562 << "\t-a, --address <connection string>\tconnection params as a single string in format: <login>:<password>@<host>:<port>\n\n";
564 //-----------------------------------------------------------------------------
565 void UsageAdmins(bool full)
567 std::cout << "Admins management options:\n"
568 << "\t--get-admins\t\t\t\tget a list of admins (subsequent options will define what to show)\n";
570 std::cout << "\t\t--login\t\t\t\tshow admin's login\n"
571 << "\t\t--priv\t\t\t\tshow admin's priviledges\n\n";
572 std::cout << "\t--get-admin\t\t\t\tget the information about admin\n";
574 std::cout << "\t\t--login <login>\t\t\tlogin of the admin to show\n"
575 << "\t\t--priv\t\t\t\tshow admin's priviledges\n\n";
576 std::cout << "\t--add-admin\t\t\t\tadd a new admin\n";
578 std::cout << "\t\t--login <login>\t\t\tlogin of the admin to add\n"
579 << "\t\t--password <password>\t\tpassword of the admin to add\n"
580 << "\t\t--priv <priv number>\t\tpriviledges of the admin to add\n\n";
581 std::cout << "\t--del-admin\t\t\t\tdelete an existing admin\n";
583 std::cout << "\t\t--login <login>\t\t\tlogin of the admin to delete\n\n";
584 std::cout << "\t--chg-admin\t\t\t\tchange an existing admin\n";
586 std::cout << "\t\t--login <login>\t\t\tlogin of the admin to change\n"
587 << "\t\t--priv <priv number>\t\tnew priviledges\n\n";
589 //-----------------------------------------------------------------------------
590 void UsageTariffs(bool full)
592 std::cout << "Tariffs management options:\n"
593 << "\t--get-tariffs\t\t\t\tget a list of tariffs (subsequent options will define what to show)\n";
595 std::cout << "\t\t--name\t\t\t\tshow tariff's name\n"
596 << "\t\t--fee\t\t\t\tshow tariff's fee\n"
597 << "\t\t--free\t\t\t\tshow tariff's prepaid traffic in terms of cost\n"
598 << "\t\t--passive-cost\t\t\tshow tariff's cost of \"freeze\"\n"
599 << "\t\t--traff-type\t\t\tshow what type of traffix will be accounted by the tariff\n"
600 << "\t\t--dirs\t\t\t\tshow tarification rules for directions\n\n";
601 std::cout << "\t--get-tariff\t\t\t\tget the information about tariff\n";
603 std::cout << "\t\t--name <name>\t\t\tname of the tariff to show\n"
604 << "\t\t--fee\t\t\t\tshow tariff's fee\n"
605 << "\t\t--free\t\t\t\tshow tariff's prepaid traffic in terms of cost\n"
606 << "\t\t--passive-cost\t\t\tshow tariff's cost of \"freeze\"\n"
607 << "\t\t--traff-type\t\t\tshow what type of traffix will be accounted by the tariff\n"
608 << "\t\t--dirs\t\t\t\tshow tarification rules for directions\n\n";
609 std::cout << "\t--add-tariff\t\t\t\tadd a new tariff\n";
611 std::cout << "\t\t--name <name>\t\t\tname of the tariff to add\n"
612 << "\t\t--fee <fee>\t\t\tstariff's fee\n"
613 << "\t\t--free <free>\t\t\ttariff's prepaid traffic in terms of cost\n"
614 << "\t\t--passive-cost <cost>\t\ttariff's cost of \"freeze\"\n"
615 << "\t\t--traff-type <type>\t\twhat type of traffi will be accounted by the tariff\n"
616 << "\t\t--times <times>\t\t\tslash-separated list of \"day\" time-spans (in form \"hh:mm-hh:mm\") for each direction\n"
617 << "\t\t--prices-day-a <prices>\t\tslash-separated list of prices for \"day\" traffic before threshold for each direction\n"
618 << "\t\t--prices-night-a <prices>\tslash-separated list of prices for \"night\" traffic before threshold for each direction\n"
619 << "\t\t--prices-day-b <prices>\t\tslash-separated list of prices for \"day\" traffic after threshold for each direction\n"
620 << "\t\t--prices-night-b <prices>\tslash-separated list of prices for \"night\" traffic after threshold for each direction\n"
621 << "\t\t--single-prices <yes|no>\tslash-separated list of \"single price\" flags for each direction\n"
622 << "\t\t--no-discounts <yes|no>\t\tslash-separated list of \"no discount\" flags for each direction\n"
623 << "\t\t--thresholds <thresholds>\tslash-separated list of thresholds (in Mb) for each direction\n\n";
624 std::cout << "\t--del-tariff\t\t\t\tdelete an existing tariff\n";
626 std::cout << "\t\t--name <name>\t\t\tname of the tariff to delete\n\n";
627 std::cout << "\t--chg-tariff\t\t\t\tchange an existing tariff\n";
629 std::cout << "\t\t--name <name>\t\t\tname of the tariff to change\n"
630 << "\t\t--fee <fee>\t\t\tstariff's fee\n"
631 << "\t\t--free <free>\t\t\ttariff's prepaid traffic in terms of cost\n"
632 << "\t\t--passive-cost <cost>\t\ttariff's cost of \"freeze\"\n"
633 << "\t\t--traff-type <type>\t\twhat type of traffix will be accounted by the tariff\n"
634 << "\t\t--dir <N>\t\t\tnumber of direction data to change\n"
635 << "\t\t\t--time <time>\t\t\"day\" time-span (in form \"hh:mm-hh:mm\")\n"
636 << "\t\t\t--price-day-a <price>\tprice for \"day\" traffic before threshold\n"
637 << "\t\t\t--price-night-a <price>\tprice for \"night\" traffic before threshold\n"
638 << "\t\t\t--price-day-b <price>\tprice for \"day\" traffic after threshold\n"
639 << "\t\t\t--price-night-b <price>\tprice for \"night\" traffic after threshold\n"
640 << "\t\t\t--single-price <yes|no>\t\"single price\" flag\n"
641 << "\t\t\t--no-discount <yes|no>\t\"no discount\" flag\n"
642 << "\t\t\t--threshold <threshold>\tthreshold (in Mb)\n\n";
644 //-----------------------------------------------------------------------------
645 void UsageUsers(bool full)
647 std::cout << "Users management options:\n"
648 << "\t--get-users\t\t\t\tget a list of users (subsequent options will define what to show)\n";
651 std::cout << "\t--get-user\t\t\t\tget the information about user\n";
654 std::cout << "\t--add-user\t\t\t\tadd a new user\n";
657 std::cout << "\t--del-user\t\t\t\tdelete an existing user\n";
660 std::cout << "\t--chg-user\t\t\t\tchange an existing user\n";
663 std::cout << "\t--check-user\t\t\t\tcheck credentials is valid\n";
666 std::cout << "\t--send-message\t\t\t\tsend a message to a user\n";
670 //-----------------------------------------------------------------------------
671 void UsageServices(bool full)
673 std::cout << "Services management options:\n"
674 << "\t--get-services\t\t\t\tget a list of services (subsequent options will define what to show)\n";
676 std::cout << "\t\t--name\t\t\t\tshow service's name\n"
677 << "\t\t--comment\t\t\tshow a comment to the service\n"
678 << "\t\t--cost\t\t\t\tshow service's cost\n"
679 << "\t\t--pay-day\t\t\tshow service's pay day\n\n";
680 std::cout << "\t--get-service\t\t\t\tget the information about service\n";
682 std::cout << "\t\t--name <name>\t\t\tname of the service to show\n"
683 << "\t\t--comment\t\t\tshow a comment to the service\n"
684 << "\t\t--cost\t\t\t\tshow service's cost\n"
685 << "\t\t--pay-day\t\t\tshow service's pay day\n\n";
686 std::cout << "\t--add-service\t\t\t\tadd a new service\n";
688 std::cout << "\t\t--name <name>\t\t\tname of the service to add\n"
689 << "\t\t--comment <comment>\t\ta comment to the service\n"
690 << "\t\t--cost <cost>\t\t\tservice's cost\n"
691 << "\t\t--pay-day <day>\t\t\tservice's pay day\n\n";
692 std::cout << "\t--del-service\t\t\t\tdelete an existing service\n";
694 std::cout << "\t\t--name <name>\t\t\tname of the service to delete\n\n";
695 std::cout << "\t--chg-service\t\t\t\tchange an existing service\n";
697 std::cout << "\t\t--name <name>\t\t\tname of the service to change\n"
698 << "\t\t--comment <comment>\t\ta comment to the service\n"
699 << "\t\t--cost <cost>\t\t\tservice's cost\n"
700 << "\t\t--pay-day <day>\t\t\tservice's pay day\n\n";
702 //-----------------------------------------------------------------------------
703 void UsageCorporations(bool full)
705 std::cout << "Corporations management options:\n"
706 << "\t--get-corporations\t\t\tget a list of corporations (subsequent options will define what to show)\n";
708 std::cout << "\t\t--name\t\t\t\tshow corporation's name\n"
709 << "\t\t--cash\t\t\t\tshow corporation's cash\n\n";
710 std::cout << "\t--get-corp\t\t\t\tget the information about corporation\n";
712 std::cout << "\t\t--name <name>\t\t\tname of the corporation to show\n"
713 << "\t\t--cash\t\t\t\tshow corporation's cash\n\n";
714 std::cout << "\t--add-corp\t\t\t\tadd a new corporation\n";
716 std::cout << "\t\t--name <name>\t\t\tname of the corporation to add\n"
717 << "\t\t--cash <cash>\t\t\tinitial corporation's cash (default: \"0\")\n\n";
718 std::cout << "\t--del-corp\t\t\t\tdelete an existing corporation\n";
720 std::cout << "\t\t--name <name>\t\t\tname of the corporation to delete\n\n";
721 std::cout << "\t--chg-corp\t\t\t\tchange an existing corporation\n";
723 std::cout << "\t\t--name <name>\t\t\tname of the corporation to change\n"
724 << "\t\t--add-cash <amount>[:<message>]\tadd cash to the corporation's account and optional comment message\n"
725 << "\t\t--set-cash <cash>[:<message>]\tnew corporation's cash and optional comment message\n\n";
730 std::cout << "sgconf, version: 2.0.0-alpha.\n";
733 } // namespace anonymous