FreeBSD Manual Pages
SHTK_CONFIG_RUN_HOOK(3) Library Functions Manual SHTK_CONFIG_RUN_HOOK(3) NAME shtk_config_run_hook -- Executes a hook defined in a configuration file LIBRARY shtk_import config SYNOPSIS shtk_config_run_hook hook [arg1 .. argN] DESCRIPTION The shtk_config_run_hook function executes the function hook, defined by the configuration file, in the same context as the file. Any argu- ments arg1 to argN are passed literally to the hook. Hooks should not be executed directly because otherwise they would need to use the shtk_config_get(3) familiy of functions to read the variables defined in the file, which could be quite strange. Keep in mind that the hook will only be able to access the configura- tion variables previously registered with shtk_config_init(3). Any other variables will be hidden and not available to the hook. EXAMPLES Consider the following configuration file: SRCDIR=/usr/src show_srcdir_hook() { # Note that we can access SRCDIR directly, as would be normal in a # configuration file. No need to use shtk_config_get. echo "SRCDIR is ${SRCDIR}" } Then, we could process the file and execute the defined hook like this: shtk_config_init SRCDIR shtk_config_load ".../path/to/the/file/above.conf" # This will print nothing because SRCDIR is not available here. echo "SRCDIR is ${SRCDIR}" # But this will display the right SRCDIR value. shtk_config_run_hook show_srcdir_hook ERRORS Errors during the execution of the hook result in the termination of the script. SEE ALSO shtk(3), shtk_config(3) HISTORY shtk_config_run_hook first appeared in shtk 1.1. FreeBSD Ports 14.quarterly November 6, 2014 SHTK_CONFIG_RUN_HOOK(3)
NAME | LIBRARY | SYNOPSIS | DESCRIPTION | EXAMPLES | ERRORS | SEE ALSO | HISTORY
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=shtk_config_run_hook&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>