DragonFly On-Line Manual Pages

Search: Section:  


SHTK_CONFIG_RUN_HOOK(3)                     DragonFly Library Functions Manual

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 arguments 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 configuration 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. DragonFly 6.5-DEVELOPMENT November 6, 2014 DragonFly 6.5-DEVELOPMENT

Search: Section: