tools

various tools
git clone git://deadbeef.fr/tools.git
Log | Files | Refs | README | LICENSE

commit 26b73340df0c17ea2d58e65d39ff1cdf13a07caf
parent 018b50ccf100fb2826e2ca7515a5b2a8264cf06f
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date:   Thu, 24 Dec 2020 12:38:05 +0100

btl: optparser can now alter cmdline

Diffstat:
Mbtl/src/optparser.cpp | 6+++---
Mbtl/src/optparser.hpp | 4++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/btl/src/optparser.cpp b/btl/src/optparser.cpp @@ -43,7 +43,7 @@ char const *parse_error_msgs[] = /*BAD_SETTER */"application bug: bad values in option", }; -parse_error_t parse_cmd_opt( char const* arg, opt_desc_t* start, opt_desc_t const* end ) +parse_error_t parse_cmd_opt( char * arg, opt_desc_t* start, opt_desc_t const* end ) { BUG_CHECK( !( arg && start && end && end > start ), BAD_ARGS ); @@ -53,12 +53,12 @@ parse_error_t parse_cmd_opt( char const* arg, opt_desc_t* start, opt_desc_t cons } opt_desc_t* opt = start; - char const* argv = arg + 2; + char* argv = arg + 2; //search for option (stores in opt) if( arg[1] == '-' ) //long { - char const* name = argv; + char* name = argv; size_t name_sz; argv = strchr( name, '=' ); if( argv ) diff --git a/btl/src/optparser.hpp b/btl/src/optparser.hpp @@ -82,7 +82,7 @@ struct opt_desc_t uint32_t short_option; uint32_t count; void* value; - bool (*set) ( void* val, char const * const arg ); + bool (*set) ( void* val, char * arg ); bool (*show)( void const* val, FILE_PTR target ); }; @@ -109,7 +109,7 @@ extern char const *parse_error_msgs[]; // return true if the argument was ignored, false if it was successfully // processed. // Range of checked options is: [start,end) -parse_error_t parse_cmd_opt( char const* arg, opt_desc_t* start, opt_desc_t const* end ); +parse_error_t parse_cmd_opt( char* arg, opt_desc_t* start, opt_desc_t const* end ); // prints a message describing options and their current value if applicable. void print_opts( FILE_PTR target, opt_desc_t const* start, opt_desc_t const* end );