summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-11-09 02:07:09 +0100
committerHaru <haru@dotalux.com>2015-01-18 21:35:36 +0100
commitce08d6238d902590dbfb650f889a8ab8887356bf (patch)
tree218266957f961e71a51a307b432b02ed9647243a /src/plugins
parent0285ddf7cee2f6569a513fe6118c43f99fd71279 (diff)
downloadhercules-ce08d6238d902590dbfb650f889a8ab8887356bf.tar.gz
hercules-ce08d6238d902590dbfb650f889a8ab8887356bf.tar.bz2
hercules-ce08d6238d902590dbfb650f889a8ab8887356bf.tar.xz
hercules-ce08d6238d902590dbfb650f889a8ab8887356bf.zip
Command line arguments handling overhaul
- login_server, char_server, map_server as well as the tools (mapcache) now have a common command line arguments handling mechanism. - All of them now accept `--help` (`-h`), `--version` (`-v`) and `--load-plugin`. - login_server now accepts `--login-config` and `--lan-config` instead of relying on positional arguments to override those files. The old syntax will no longer work, please update your custom startup scripts. - char_server now accepts `--char-config`, `--inter-config`, `--lan-config` instead of relying on positional arguments. The old syntax will no longer work, please update your custom startup scripts. - mapcache now accepts `--grf-list`, `--map-list`, `--map-cache`, `--rebuild` in place of, respectively, `-grf`, `-list`, `-cache`, `-rebuild`. - A new macro `CMDLINEARG()` is provided, to help defining new command line argument handlers (i.e. in plugins). the `addArg()` call is still required, but its syntax has changed. The `help` argument is now of type `const char *` rather than a function pointer, and it is supposed to contain the message to show in the `--help` screen. Pass `NULL` if no help message is desired. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/db2sql.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c
index eda61d026..62ed80255 100644
--- a/src/plugins/db2sql.c
+++ b/src/plugins/db2sql.c
@@ -348,8 +348,10 @@ void do_db2sql(void) {
CPCMD(db2sql) {
do_db2sql();
}
-void db2sql_arg(char *param) {
+CMDLINEARG(db2sql)
+{
map->minimal = torun = true;
+ return true;
}
HPExport void server_preinit (void) {
SQL = GET_SYMBOL("SQL");
@@ -360,7 +362,7 @@ HPExport void server_preinit (void) {
libconfig = GET_SYMBOL("libconfig");
StrBuf = GET_SYMBOL("StrBuf");
- addArg("--db2sql",false,db2sql_arg,NULL);
+ addArg("--db2sql",false,db2sql,NULL);
}
HPExport void plugin_init (void) {
addCPCommand("server:tools:db2sql",db2sql);