diff options
| author | kx <kx@radix-linux.su> | 2026-10-01 12:02:28 +0300 |
|---|---|---|
| committer | kx <kx@radix-linux.su> | 2026-10-01 12:02:28 +0300 |
| commit | ba1b04d64bdfaf377915b22f77520216ebe47674 (patch) | |
| tree | 044343035c28b2b04ca9725f26e9b7c39342d19c /tests/mcpp-options-test.c | |
| parent | 124b140798456778e2a96851cc7268aa9a726698 (diff) | |
| download | mcpu-cpp-1.0.2.tar.xz | |
Version 1.0.21.0.2
Diffstat (limited to 'tests/mcpp-options-test.c')
| -rw-r--r-- | tests/mcpp-options-test.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/mcpp-options-test.c b/tests/mcpp-options-test.c new file mode 100644 index 0000000..a0e8311 --- /dev/null +++ b/tests/mcpp-options-test.c @@ -0,0 +1,24 @@ +#include <defs.h> + +int +main( int argc, char **argv ) +{ + mcpp_options options; + const char *p; + int rc = 1; + + mcpp_options_init( &options, argc ); + if( options.actions == NULL ) + return( 1 ); + + p = argv[0] + strlen( argv[0] ); + while( p != argv[0] && p[-1] != '/' ) --p; + options.progname = p; + + if( mcpp_handle_options(&options, argc - 1, argv + 1) == 0 && + mcpp_options_dump(&options, stdout) == 0 ) + rc = 0; + + mcpp_options_free( &options ); + return( rc ); +} |
