[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_ConfigGetBool

Overview

Get a boolean configuration file variable

Syntax

    int Ns_ConfigGetBool(
    char *hSection,
    char *sKey,
    int *pbValue
    );

Description

The Ns_ConfigGetBool function returns the boolean value of the specified key (sKey) in the specified configuration file section (hSection) and puts it into the integer pointed to by pbValue as a 1 or 0. Values of "1", "y", "yes", "on", "t", and "true" are 1, and values of "0", "n", "no", "f", and "false" are 0. If any other value is found, a warning is written to the log and NS_FALSE is returned. Ns_ConfigGetBool returns NS_TRUE if a valid sKey exists and NS_FALSE otherwise.

Examples

    	int opt;
    
    	if (Ns_ConfigGetBool("MySect", "MyKey", &opt) != NS_TRUE) {
    		/* Option was not present or invalid - set a default. */
    		opt = 0;	/* off */
    	}

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1998-99 America Online, Inc.