From: Philippe Proulx Date: Wed, 2 Jun 2021 15:40:32 +0000 (-0400) Subject: Add parsing error API X-Git-Url: http://git.efficios.com/?p=argpar.git;a=commitdiff_plain;h=8b95d883334b188d05cb1967980eae628e295d10;hp=8b95d883334b188d05cb1967980eae628e295d10;ds=sidebyside Add parsing error API This patch adds the `struct argpar_error` type which contains details about a parsing error. Get said details with the new dedicated property getters: argpar_error_orig_index(): Returns the index of the original argument for which the error occurred. argpar_error_unknown_opt_name(): Returns the name of the unknown option for which the error occurred. argpar_error_opt_descr(): Returns the descriptor of the option for which the error occurred. Also sets an output boolean parameter to whether said option is short or long. Destroy a parsing error with argpar_error_destroy(). argpar_iter_next() now sets such a parsing error object on parsing error instead of an error string. You can build a corresponding error string from the properties of the parsing error object. See the updated user documentation in `argpar.h` for more details. In `test_argpar.c`, test_fail() now ensures that argpar_iter_next() sets an parsing error object and that, depending on the returned status code, its properties have expected values. I moved the "unknown option" tests from succeed_tests() to fail_tests() as this was a vestige of the `fail_on_unknown_opt` parameter of argpar_parse(). Signed-off-by: Philippe Proulx Change-Id: I7b988253f653f96e6bf6859ae1b48bbcf6fb406d ---