labwc/include/common/parse-bool.h
Tomi Ollila 7ad5200f2e includes: identifier consistency in include guards
Made all header files to have LABWC_ prefix in include guard identifers.

Converted from __LABWC_ in 35 include/ files.
Converted from __LAB_ in 5 include/ files.
Added LABWC prefix to 3 include/ files.
Added include guards to 3 include/ files.

The double underscores were removed since according to C standard
those "are always reserved for any use".
2023-05-13 22:29:21 +01:00

24 lines
783 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_PARSE_BOOL_H
#define LABWC_PARSE_BOOL_H
#include <stdbool.h>
/**
* parse_bool() - Parse boolean value of string.
* @string: String to interpret. This check is case-insensitive.
* @default_value: Default value to use if string is not a recognised boolean.
* Use -1 to avoid setting a default value.
*
* Return: 0 for false; 1 for true; -1 for non-boolean
*/
int parse_bool(const char *str, int default_value);
/**
* set_bool() - Parse boolean text and set variable iff text is valid boolean
* @string: Boolean text to interpret.
* @variable: Variable to set.
*/
void set_bool(const char *str, bool *variable);
void set_bool_as_int(const char *str, int *variable);
#endif /* LABWC_PARSE_BOOL_H */