Added a generic string to boolean parser.

This commit is contained in:
Jan Vidar Krey
2010-07-29 08:42:40 +02:00
parent 97feb3635e
commit c75090cdf2
2 changed files with 43 additions and 0 deletions

View File

@@ -37,6 +37,14 @@ extern void strip_off_ini_line_comments(char* line, int line_count);
extern int file_read_lines(const char* file, void* data, file_line_handler_t handler);
/**
* Convert a string to a boolean (0 or 1).
* Example:
* "yes", "true", "1", "on" sets 1 in boolean, and returns 1.
* "no", "false", "0", "off" sets 0 in boolean, and returns 1.
* All other values return 0, and boolean is unchanged.
*/
extern int string_to_boolean(const char* str, int* boolean);
extern const char* uhub_itoa(int val);