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>
23 #include "common_sg.h"
24 #include "sg_error_codes.h"
34 #include "stg/user_conf.h"
35 #include "stg/user_stat.h"
36 #include "stg/common.h"
57 typedef typename T::value_type type;
61 struct ARRAY_TYPE<T[]>
66 template <typename T, size_t N>
67 struct ARRAY_TYPE<T[N]>
73 struct nullary_function
75 typedef T result_type;
79 class binder0 : public nullary_function<typename F::result_type>
82 binder0(const F & func, const typename F::argument_type & arg)
83 : m_func(func), m_arg(arg) {}
84 typename F::result_type operator()() const { return m_func(m_arg); }
87 typename F::argument_type m_arg;
92 binder0<F> bind0(const F & func, const typename F::argument_type & arg)
94 return binder0<F>(func, arg);
97 template <typename C, typename A, typename R>
98 class METHOD1_ADAPTER : public std::unary_function<A, R>
101 METHOD1_ADAPTER(R (C::* func)(A), C & obj) : m_func(func), m_obj(obj) {}
102 R operator()(A arg) { return (m_obj.*m_func)(arg); }
108 template <typename C, typename A, typename R>
109 class CONST_METHOD1_ADAPTER : public std::unary_function<A, R>
112 CONST_METHOD1_ADAPTER(R (C::* func)(A) const, C & obj) : m_func(func), m_obj(obj) {}
113 R operator()(A arg) const { return (m_obj.*m_func)(arg); }
115 R (C::* m_func)(A) const;
119 template <typename C, typename A, typename R>
120 METHOD1_ADAPTER<C, A, R> Method1Adapt(R (C::* func)(A), C & obj)
122 return METHOD1_ADAPTER<C, A, R>(func, obj);
125 template <typename C, typename A, typename R>
126 CONST_METHOD1_ADAPTER<C, A, R> Method1Adapt(R (C::* func)(A) const, C & obj)
128 return CONST_METHOD1_ADAPTER<C, A, R>(func, obj);
131 template <typename T>
132 bool SetArrayItem(T & array, const char * index, const typename ARRAY_TYPE<T>::type & value)
135 if (str2x(index, pos))
141 void RawXMLCallback(bool result, const std::string & reason, const std::string & response, void * /*data*/)
145 std::cerr << "Failed to get raw XML response. Reason: '" << reason << "'." << std::endl;
148 SGCONF::PrintXML(response);
153 void UsageImpl(bool full);
154 void UsageConnection();
155 void UsageAdmins(bool full);
156 void UsageTariffs(bool full);
157 void UsageUsers(bool full);
158 void UsageServices(bool full);
159 void UsageCorporations(bool full);
163 void ReadUserConfigFile(SGCONF::OPTION_BLOCK & block)
165 std::vector<std::string> paths;
166 const char * configHome = getenv("XDG_CONFIG_HOME");
167 if (configHome == NULL)
169 const char * home = getenv("HOME");
172 paths.push_back(std::string(home) + "/.config/sgconf/sgconf.conf");
173 paths.push_back(std::string(home) + "/.sgconf/sgconf.conf");
176 paths.push_back(std::string(configHome) + "/sgconf/sgconf.conf");
177 for (std::vector<std::string>::const_iterator it = paths.begin(); it != paths.end(); ++it)
178 if (access(it->c_str(), R_OK) == 0)
180 block.ParseFile(*it);
185 } // namespace anonymous
190 class CONFIG_ACTION : public ACTION
193 CONFIG_ACTION(SGCONF::CONFIG & config,
194 const std::string & paramDescription)
196 m_description(paramDescription)
199 virtual ACTION * Clone() const { return new CONFIG_ACTION(*this); }
201 virtual std::string ParamDescription() const { return m_description; }
202 virtual std::string DefaultDescription() const { return ""; }
203 virtual OPTION_BLOCK & Suboptions() { return m_suboptions; }
204 virtual PARSER_STATE Parse(int argc, char ** argv);
207 SGCONF::CONFIG & m_config;
208 std::string m_description;
209 OPTION_BLOCK m_suboptions;
211 void ParseCredentials(const std::string & credentials);
212 void ParseHostAndPort(const std::string & hostAndPort);
215 typedef bool (* API_FUNCTION) (const SGCONF::CONFIG &,
217 const std::map<std::string, std::string> &);
222 COMMAND(API_FUNCTION funPtr,
223 const std::string & arg,
224 const std::map<std::string, std::string> & options)
229 bool Execute(const SGCONF::CONFIG & config) const
231 return m_funPtr(config, m_arg, m_options);
235 API_FUNCTION m_funPtr;
237 std::map<std::string, std::string> m_options;
243 void Add(API_FUNCTION funPtr,
244 const std::string & arg,
245 const std::map<std::string, std::string> & options) { m_commands.push_back(COMMAND(funPtr, arg, options)); }
246 bool Execute(const SGCONF::CONFIG & config) const
248 std::list<COMMAND>::const_iterator it(m_commands.begin());
250 while (it != m_commands.end() && res)
252 res = res && it->Execute(config);
258 std::list<COMMAND> m_commands;
261 class API_ACTION : public ACTION
264 API_ACTION(COMMANDS & commands,
265 const std::string & paramDescription,
267 const OPTION_BLOCK& suboptions,
269 : m_commands(commands),
270 m_description(paramDescription),
271 m_argument(needArgument ? "1" : ""), // Hack
272 m_suboptions(suboptions),
275 API_ACTION(COMMANDS & commands,
276 const std::string & paramDescription,
279 : m_commands(commands),
280 m_description(paramDescription),
281 m_argument(needArgument ? "1" : ""), // Hack
285 virtual ACTION * Clone() const { return new API_ACTION(*this); }
287 virtual std::string ParamDescription() const { return m_description; }
288 virtual std::string DefaultDescription() const { return ""; }
289 virtual OPTION_BLOCK & Suboptions() { return m_suboptions; }
290 virtual PARSER_STATE Parse(int argc, char ** argv)
292 PARSER_STATE state(false, argc, argv);
293 if (!m_argument.empty())
298 throw ERROR("Missing argument.");
303 m_suboptions.Parse(state.argc, state.argv);
304 m_commands.Add(m_funPtr, m_argument, m_params);
309 COMMANDS & m_commands;
310 std::string m_description;
311 std::string m_argument;
312 OPTION_BLOCK m_suboptions;
313 std::map<std::string, std::string> m_params;
314 API_FUNCTION m_funPtr;
317 PARSER_STATE CONFIG_ACTION::Parse(int argc, char ** argv)
322 throw ERROR("Missing argument.");
323 char * pos = strchr(*argv, '@');
326 ParseCredentials(std::string(*argv, pos));
327 ParseHostAndPort(std::string(pos + 1));
331 ParseHostAndPort(std::string(*argv));
333 return PARSER_STATE(false, --argc, ++argv);
336 void CONFIG_ACTION::ParseCredentials(const std::string & credentials)
338 std::string::size_type pos = credentials.find_first_of(':');
339 if (pos != std::string::npos)
341 m_config.userName = credentials.substr(0, pos);
342 m_config.userPass = credentials.substr(pos + 1);
346 m_config.userName = credentials;
350 void CONFIG_ACTION::ParseHostAndPort(const std::string & hostAndPort)
352 std::string::size_type pos = hostAndPort.find_first_of(':');
353 if (pos != std::string::npos)
355 m_config.server = hostAndPort.substr(0, pos);
357 if (str2x(hostAndPort.substr(pos + 1), port))
358 throw ERROR("Invalid port value: '" + hostAndPort.substr(pos + 1) + "'");
359 m_config.port = port;
363 m_config.server = hostAndPort;
368 CONFIG_ACTION * MakeParamAction(SGCONF::CONFIG & config,
369 const std::string & paramDescription)
371 return new CONFIG_ACTION(config, paramDescription);
375 ACTION * MakeAPIAction(COMMANDS & commands,
376 const std::string & paramDescription,
380 return new API_ACTION(commands, paramDescription, needArgument, funPtr);
384 ACTION * MakeAPIAction(COMMANDS & commands,
387 return new API_ACTION(commands, "", false, funPtr);
390 bool RawXMLFunction(const SGCONF::CONFIG & config,
391 const std::string & arg,
392 const std::map<std::string, std::string> & /*options*/)
394 STG::SERVCONF proto(config.server.data(),
396 config.userName.data(),
397 config.userPass.data());
398 return proto.RawXML(arg, RawXMLCallback, NULL) == STG::st_ok;
401 } // namespace SGCONF
405 //-----------------------------------------------------------------------------
406 int main(int argc, char **argv)
408 SGCONF::CONFIG config;
409 SGCONF::COMMANDS commands;
411 SGCONF::OPTION_BLOCKS blocks;
412 blocks.Add("General options")
413 .Add("c", "config", SGCONF::MakeParamAction(config.configFile, std::string("~/.config/stg/sgconf.conf"), "<config file>"), "override default config file")
414 .Add("h", "help", SGCONF::MakeFunc0Action(bind0(Method1Adapt(&SGCONF::OPTION_BLOCKS::Help, blocks), 0)), "\t\tshow this help and exit")
415 .Add("help-all", SGCONF::MakeFunc0Action(UsageAll), "\t\tshow full help and exit")
416 .Add("v", "version", SGCONF::MakeFunc0Action(Version), "\t\tshow version information and exit");
417 SGCONF::OPTION_BLOCK & block = blocks.Add("Connection options")
418 .Add("s", "server", SGCONF::MakeParamAction(config.server, std::string("localhost"), "<address>"), "\t\thost to connect")
419 .Add("p", "port", SGCONF::MakeParamAction(config.port, uint16_t(5555), "<port>"), "\t\tport to connect")
420 .Add("u", "username", SGCONF::MakeParamAction(config.userName, std::string("admin"), "<username>"), "\tadministrative login")
421 .Add("w", "userpass", SGCONF::MakeParamAction(config.userPass, "<password>"), "\tpassword for the administrative login")
422 .Add("a", "address", SGCONF::MakeParamAction(config, "<connection string>"), "connection params as a single string in format: <login>:<password>@<host>:<port>");
423 blocks.Add("Raw XML")
424 .Add("r", "raw", SGCONF::MakeAPIAction(commands, "<xml>", true, SGCONF::RawXMLFunction), "\tmake raw XML request");
425 blocks.Add("Admin management options")
426 .Add("get-admins", SGCONF::MakeAPIAction(commands, SGCONF::GetAdminsFunction), "\tget admin list")
427 .Add("get-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::GetAdminFunction), "\tget admin")
428 .Add("add-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::AddAdminFunction), "\tadd admin")
429 .Add("del-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::DelAdminFunction), "\tdel admin")
430 .Add("chg-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::ChgAdminFunction), "\tchange admin");
431 blocks.Add("Tariff management options")
432 .Add("get-tariffs", SGCONF::MakeAPIAction(commands, SGCONF::GetTariffsFunction), "\tget tariff list")
433 .Add("get-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::GetTariffFunction), "\tget tariff")
434 .Add("add-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::AddTariffFunction), "\tadd tariff")
435 .Add("del-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::DelTariffFunction), "\tdel tariff")
436 .Add("chg-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::ChgTariffFunction), "\tchange tariff");
437 blocks.Add("User management options")
438 .Add("get-users", SGCONF::MakeAPIAction(commands, SGCONF::GetUsersFunction), "\tget user list")
439 .Add("get-user", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::GetUserFunction), "\tget user")
440 .Add("add-user", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::AddUserFunction), "\tadd user")
441 .Add("del-user", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::DelUserFunction), "\tdel user")
442 .Add("chg-user", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::ChgUserFunction), "\tchange user");
444 SGCONF::PARSER_STATE state(false, argc, argv);
448 state = blocks.Parse(--argc, ++argv); // Skipping self name
450 catch (const SGCONF::OPTION::ERROR& ex)
452 std::cerr << ex.what() << "\n";
461 std::cerr << "Unknown option: '" << *state.argv << "'\n";
467 SGCONF::CONFIG configOverride(config);
469 if (config.configFile.empty())
471 const char * mainConfigFile = "/etc/sgconf/sgconf.conf";
472 if (access(mainConfigFile, R_OK) == 0)
473 block.ParseFile(mainConfigFile);
474 ReadUserConfigFile(block);
478 block.ParseFile(config.configFile.data());
481 config = configOverride;
483 catch (const std::exception& ex)
485 std::cerr << ex.what() << "\n";
489 std::cerr << "Config: " << config.Serialize() << std::endl;
490 return commands.Execute(config) ? 0 : -1;
503 exit(PARAMETER_PARSING_ERR_CODE);
506 if (strcmp(argv[1], "get") == 0)
509 return mainGet(argc - 1, argv + 1);
511 else if (strcmp(argv[1], "set") == 0)
514 if (mainSet(argc - 1, argv + 1) )
521 exit(PARAMETER_PARSING_ERR_CODE);
523 return UNKNOWN_ERR_CODE;*/
525 //-----------------------------------------------------------------------------
540 void UsageImpl(bool full)
542 std::cout << "sgconf is the Stargazer management utility.\n\n"
544 << "\tsgconf [options]\n\n"
545 << "General options:\n"
546 << "\t-c, --config <config file>\t\toverride default config file (default: \"~/.config/stg/sgconf.conf\")\n"
547 << "\t-h, --help\t\t\t\tshow this help and exit\n"
548 << "\t--help-all\t\t\t\tshow full help and exit\n"
549 << "\t-v, --version\t\t\t\tshow version information and exit\n\n";
555 UsageCorporations(full);
557 //-----------------------------------------------------------------------------
558 void UsageConnection()
560 std::cout << "Connection options:\n"
561 << "\t-s, --server <address>\t\t\thost to connect (ip or domain name, default: \"localhost\")\n"
562 << "\t-p, --port <port>\t\t\tport to connect (default: \"5555\")\n"
563 << "\t-u, --username <username>\t\tadministrative login (default: \"admin\")\n"
564 << "\t-w, --userpass <password>\t\tpassword for administrative login\n"
565 << "\t-a, --address <connection string>\tconnection params as a single string in format: <login>:<password>@<host>:<port>\n\n";
567 //-----------------------------------------------------------------------------
568 void UsageAdmins(bool full)
570 std::cout << "Admins management options:\n"
571 << "\t--get-admins\t\t\t\tget a list of admins (subsequent options will define what to show)\n";
573 std::cout << "\t\t--login\t\t\t\tshow admin's login\n"
574 << "\t\t--priv\t\t\t\tshow admin's priviledges\n\n";
575 std::cout << "\t--get-admin\t\t\t\tget the information about admin\n";
577 std::cout << "\t\t--login <login>\t\t\tlogin of the admin to show\n"
578 << "\t\t--priv\t\t\t\tshow admin's priviledges\n\n";
579 std::cout << "\t--add-admin\t\t\t\tadd a new admin\n";
581 std::cout << "\t\t--login <login>\t\t\tlogin of the admin to add\n"
582 << "\t\t--password <password>\t\tpassword of the admin to add\n"
583 << "\t\t--priv <priv number>\t\tpriviledges of the admin to add\n\n";
584 std::cout << "\t--del-admin\t\t\t\tdelete an existing admin\n";
586 std::cout << "\t\t--login <login>\t\t\tlogin of the admin to delete\n\n";
587 std::cout << "\t--chg-admin\t\t\t\tchange an existing admin\n";
589 std::cout << "\t\t--login <login>\t\t\tlogin of the admin to change\n"
590 << "\t\t--priv <priv number>\t\tnew priviledges\n\n";
592 //-----------------------------------------------------------------------------
593 void UsageTariffs(bool full)
595 std::cout << "Tariffs management options:\n"
596 << "\t--get-tariffs\t\t\t\tget a list of tariffs (subsequent options will define what to show)\n";
598 std::cout << "\t\t--name\t\t\t\tshow tariff's name\n"
599 << "\t\t--fee\t\t\t\tshow tariff's fee\n"
600 << "\t\t--free\t\t\t\tshow tariff's prepaid traffic in terms of cost\n"
601 << "\t\t--passive-cost\t\t\tshow tariff's cost of \"freeze\"\n"
602 << "\t\t--traff-type\t\t\tshow what type of traffix will be accounted by the tariff\n"
603 << "\t\t--dirs\t\t\t\tshow tarification rules for directions\n\n";
604 std::cout << "\t--get-tariff\t\t\t\tget the information about tariff\n";
606 std::cout << "\t\t--name <name>\t\t\tname of the tariff to show\n"
607 << "\t\t--fee\t\t\t\tshow tariff's fee\n"
608 << "\t\t--free\t\t\t\tshow tariff's prepaid traffic in terms of cost\n"
609 << "\t\t--passive-cost\t\t\tshow tariff's cost of \"freeze\"\n"
610 << "\t\t--traff-type\t\t\tshow what type of traffix will be accounted by the tariff\n"
611 << "\t\t--dirs\t\t\t\tshow tarification rules for directions\n\n";
612 std::cout << "\t--add-tariff\t\t\t\tadd a new tariff\n";
614 std::cout << "\t\t--name <name>\t\t\tname of the tariff to add\n"
615 << "\t\t--fee <fee>\t\t\tstariff's fee\n"
616 << "\t\t--free <free>\t\t\ttariff's prepaid traffic in terms of cost\n"
617 << "\t\t--passive-cost <cost>\t\ttariff's cost of \"freeze\"\n"
618 << "\t\t--traff-type <type>\t\twhat type of traffi will be accounted by the tariff\n"
619 << "\t\t--times <times>\t\t\tslash-separated list of \"day\" time-spans (in form \"hh:mm-hh:mm\") for each direction\n"
620 << "\t\t--prices-day-a <prices>\t\tslash-separated list of prices for \"day\" traffic before threshold for each direction\n"
621 << "\t\t--prices-night-a <prices>\tslash-separated list of prices for \"night\" traffic before threshold for each direction\n"
622 << "\t\t--prices-day-b <prices>\t\tslash-separated list of prices for \"day\" traffic after threshold for each direction\n"
623 << "\t\t--prices-night-b <prices>\tslash-separated list of prices for \"night\" traffic after threshold for each direction\n"
624 << "\t\t--single-prices <yes|no>\tslash-separated list of \"single price\" flags for each direction\n"
625 << "\t\t--no-discounts <yes|no>\t\tslash-separated list of \"no discount\" flags for each direction\n"
626 << "\t\t--thresholds <thresholds>\tslash-separated list of thresholds (in Mb) for each direction\n\n";
627 std::cout << "\t--del-tariff\t\t\t\tdelete an existing tariff\n";
629 std::cout << "\t\t--name <name>\t\t\tname of the tariff to delete\n\n";
630 std::cout << "\t--chg-tariff\t\t\t\tchange an existing tariff\n";
632 std::cout << "\t\t--name <name>\t\t\tname of the tariff to change\n"
633 << "\t\t--fee <fee>\t\t\tstariff's fee\n"
634 << "\t\t--free <free>\t\t\ttariff's prepaid traffic in terms of cost\n"
635 << "\t\t--passive-cost <cost>\t\ttariff's cost of \"freeze\"\n"
636 << "\t\t--traff-type <type>\t\twhat type of traffix will be accounted by the tariff\n"
637 << "\t\t--dir <N>\t\t\tnumber of direction data to change\n"
638 << "\t\t\t--time <time>\t\t\"day\" time-span (in form \"hh:mm-hh:mm\")\n"
639 << "\t\t\t--price-day-a <price>\tprice for \"day\" traffic before threshold\n"
640 << "\t\t\t--price-night-a <price>\tprice for \"night\" traffic before threshold\n"
641 << "\t\t\t--price-day-b <price>\tprice for \"day\" traffic after threshold\n"
642 << "\t\t\t--price-night-b <price>\tprice for \"night\" traffic after threshold\n"
643 << "\t\t\t--single-price <yes|no>\t\"single price\" flag\n"
644 << "\t\t\t--no-discount <yes|no>\t\"no discount\" flag\n"
645 << "\t\t\t--threshold <threshold>\tthreshold (in Mb)\n\n";
647 //-----------------------------------------------------------------------------
648 void UsageUsers(bool full)
650 std::cout << "Users management options:\n"
651 << "\t--get-users\t\t\t\tget a list of users (subsequent options will define what to show)\n";
654 std::cout << "\t--get-user\t\t\t\tget the information about user\n";
657 std::cout << "\t--add-user\t\t\t\tadd a new user\n";
660 std::cout << "\t--del-user\t\t\t\tdelete an existing user\n";
663 std::cout << "\t--chg-user\t\t\t\tchange an existing user\n";
666 std::cout << "\t--check-user\t\t\t\tcheck credentials is valid\n";
669 std::cout << "\t--send-message\t\t\t\tsend a message to a user\n";
673 //-----------------------------------------------------------------------------
674 void UsageServices(bool full)
676 std::cout << "Services management options:\n"
677 << "\t--get-services\t\t\t\tget a list of services (subsequent options will define what to show)\n";
679 std::cout << "\t\t--name\t\t\t\tshow service's name\n"
680 << "\t\t--comment\t\t\tshow a comment to the service\n"
681 << "\t\t--cost\t\t\t\tshow service's cost\n"
682 << "\t\t--pay-day\t\t\tshow service's pay day\n\n";
683 std::cout << "\t--get-service\t\t\t\tget the information about service\n";
685 std::cout << "\t\t--name <name>\t\t\tname of the service to show\n"
686 << "\t\t--comment\t\t\tshow a comment to the service\n"
687 << "\t\t--cost\t\t\t\tshow service's cost\n"
688 << "\t\t--pay-day\t\t\tshow service's pay day\n\n";
689 std::cout << "\t--add-service\t\t\t\tadd a new service\n";
691 std::cout << "\t\t--name <name>\t\t\tname of the service to add\n"
692 << "\t\t--comment <comment>\t\ta comment to the service\n"
693 << "\t\t--cost <cost>\t\t\tservice's cost\n"
694 << "\t\t--pay-day <day>\t\t\tservice's pay day\n\n";
695 std::cout << "\t--del-service\t\t\t\tdelete an existing service\n";
697 std::cout << "\t\t--name <name>\t\t\tname of the service to delete\n\n";
698 std::cout << "\t--chg-service\t\t\t\tchange an existing service\n";
700 std::cout << "\t\t--name <name>\t\t\tname of the service to change\n"
701 << "\t\t--comment <comment>\t\ta comment to the service\n"
702 << "\t\t--cost <cost>\t\t\tservice's cost\n"
703 << "\t\t--pay-day <day>\t\t\tservice's pay day\n\n";
705 //-----------------------------------------------------------------------------
706 void UsageCorporations(bool full)
708 std::cout << "Corporations management options:\n"
709 << "\t--get-corporations\t\t\tget a list of corporations (subsequent options will define what to show)\n";
711 std::cout << "\t\t--name\t\t\t\tshow corporation's name\n"
712 << "\t\t--cash\t\t\t\tshow corporation's cash\n\n";
713 std::cout << "\t--get-corp\t\t\t\tget the information about corporation\n";
715 std::cout << "\t\t--name <name>\t\t\tname of the corporation to show\n"
716 << "\t\t--cash\t\t\t\tshow corporation's cash\n\n";
717 std::cout << "\t--add-corp\t\t\t\tadd a new corporation\n";
719 std::cout << "\t\t--name <name>\t\t\tname of the corporation to add\n"
720 << "\t\t--cash <cash>\t\t\tinitial corporation's cash (default: \"0\")\n\n";
721 std::cout << "\t--del-corp\t\t\t\tdelete an existing corporation\n";
723 std::cout << "\t\t--name <name>\t\t\tname of the corporation to delete\n\n";
724 std::cout << "\t--chg-corp\t\t\t\tchange an existing corporation\n";
726 std::cout << "\t\t--name <name>\t\t\tname of the corporation to change\n"
727 << "\t\t--add-cash <amount>[:<message>]\tadd cash to the corporation's account and optional comment message\n"
728 << "\t\t--set-cash <cash>[:<message>]\tnew corporation's cash and optional comment message\n\n";
733 std::cout << "sgconf, version: 2.0.0-alpha.\n";
736 } // namespace anonymous