diff options
author | Haru <haru@dotalux.com> | 2014-11-09 02:07:09 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-01-18 21:35:36 +0100 |
commit | ce08d6238d902590dbfb650f889a8ab8887356bf (patch) | |
tree | 218266957f961e71a51a307b432b02ed9647243a /src/common/HPMi.h | |
parent | 0285ddf7cee2f6569a513fe6118c43f99fd71279 (diff) | |
download | hercules-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/common/HPMi.h')
-rw-r--r-- | src/common/HPMi.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 47f4e6b8b..d4b2e323c 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -104,7 +104,7 @@ enum HPluginConfType { #define hookStop() (HPMi->HookStop(__func__,HPMi->pid)) #define hookStopped() (HPMi->HookStopped()) -#define addArg(name,param,func,help) (HPMi->addArg(HPMi->pid,(name),(param),(func),(help))) +#define addArg(name, param,func,help) (HPMi->addArg(HPMi->pid,(name),(param),(cmdline_arg_ ## func),(help))) /* HPData handy redirects */ /* session[] */ #define addToSession(ptr,data,index,autofree) (HPMi->addToHPData(HPDT_SESSION,HPMi->pid,(ptr),(data),(index),(autofree))) @@ -214,7 +214,7 @@ HPExport struct HPMi_interface { void (*HookStop) (const char *func, unsigned int pID); bool (*HookStopped) (void); /* program --arg/-a */ - bool (*addArg) (unsigned int pluginID, char *name, bool has_param,void (*func) (char *param),void (*help) (void)); + bool (*addArg) (unsigned int pluginID, char *name, bool has_param, CmdlineExecFunc func, const char *help); /* battle-config recv param */ bool (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*func) (const char *val)); /* pc group permission */ |