diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-04-24 10:00:09 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-04-24 10:06:54 +0200 |
commit | d16640130e65ed4af76d285a4339a0c200ee41b0 (patch) | |
tree | 1c78302f9726ac301af1f91e755ee863f6dcb17d /src/core/hook/wee-hook-process.c | |
parent | 95cf2aa9565233e73c356c7f3c83ea9815fa4dbc (diff) | |
download | weechat-d16640130e65ed4af76d285a4339a0c200ee41b0.zip |
core: add functions to get short description of hooks
Diffstat (limited to 'src/core/hook/wee-hook-process.c')
-rw-r--r-- | src/core/hook/wee-hook-process.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/hook/wee-hook-process.c b/src/core/hook/wee-hook-process.c index 9a48e4c1e..15366eb3b 100644 --- a/src/core/hook/wee-hook-process.c +++ b/src/core/hook/wee-hook-process.c @@ -50,6 +50,25 @@ void hook_process_run (struct t_hook *hook_process); /* + * Returns description of hook. + * + * Note: result must be freed after use. + */ + +char * +hook_process_get_description (struct t_hook *hook) +{ + char str_desc[1024]; + + snprintf (str_desc, sizeof (str_desc), + "command: \"%s\", child pid: %d", + HOOK_PROCESS(hook, command), + HOOK_PROCESS(hook, child_pid)); + + return strdup (str_desc); +} + +/* * Hooks a process (using fork) with options in hashtable. * * Returns pointer to new hook, NULL if error. |