summaryrefslogtreecommitdiff
path: root/tests/mcpp-options-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mcpp-options-test.c')
-rw-r--r--tests/mcpp-options-test.c24
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 );
+}