GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SHTK_CONFIG_OVERRIDE(3) FreeBSD Library Functions Manual SHTK_CONFIG_OVERRIDE(3)

shtk_config_override
Records an override to be applied to the configuration

shtk_import config

shtk_config_override override

The shtk_config_override function records the override given in override, which must have the form ‘variable=value’.

Overrides are values given to configuration variables that can be set before the configuration file is loaded with shtk_config_load(3). This feature is useful to support parsing all command line flags before attempting to load the configuration file, as the script should first validate all user input before performing any action.

This code snippet illustrates a program with a configuration file that supports a VERBOSE variable and that, for convenience reasons, can be overriden via the command line using the -v flag:
shtk_config_init VERBOSE

local OPTIND
while getopts ':v' arg "${@}"; do
    case "${arg}" in
        v)  # Enable verbose mode.
            shtk_config_override VERBOSE=yes
            ;;
        \?)
            shtk_cli_usage_error "Unknown option -${OPTARG}"
            ;;
    esac
done
shift $((${OPTIND} - 1))

shtk_config_set VERBOSE no  # Set the default value.
shtk_config_load "/etc/my_program.conf"

shtk(3), shtk_config(3)

shtk_config_override first appeared in shtk 1.0.
November 6, 2014 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.